+ 2
Substitute inside a string
If the user inputs "5,7" instead of "5.7", the float conversion would not work. How do you substitute the comma with the point in the input value?
1 ответ
+ 8
It's very simple:
print(float(input().replace(",", ".")))
If the user inputs "5,7" instead of "5.7", the float conversion would not work. How do you substitute the comma with the point in the input value?