Python: Swap comma and dot in a string
Swap commas and dots in a string.
Write a Python program to swap commas and dots in a string.
Sample Solution:
Python Code:
Sample Output:
32,054.23
Flowchart:
For more Practice: Solve these Related Problems:
- Write a Python program to swap every comma with a dot and every dot with a comma in a given string.
- Write a Python program to implement a function that iterates through a string and interchanges commas and periods.
- Write a Python program to use regular expressions to find commas and dots and swap them in the output string.
- Write a Python program to convert the input string into a list of characters, swap commas and dots, and then reassemble the string.
Go to:
Previous: Write a Python program to lowercase first n characters in a string.
Next: Write a Python program to count and display the vowels of a given text.
Python Code Editor:
Contribute your code and comments through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.