3 Réponses
+ 3
Please link your code and describe the expected input
+ 3
You may want to trim the input before use it in your code.
Have a look at strip(), lstrip(), rstrip() functions.
+ 2
Why should there be an error? I tried these and got valid results
i1 = int( input() ) # input " 2022"
f1 = float( input() ) # input " 2022.1702"
print( i1, f1 )
String input works fine as well ...
You may also wrap the input reading block inside a try...except block in anticipation of data conversion error.