+ 1
How to give user input as 15.5+25.5-35.5 in python ?
5 ответов
+ 6
If you want to calculate user's input...
s = str(input()) #input 15.5+25.5-35.5
print(eval(s)) #output is 5.5
+ 1
Explain in better detail.
+ 1
Thanks Anton Popov ...it is working fine
+ 1
If you want to calculate user's input...
s = str(input()) #input 15.5+25.5-35.5
print(eval(s)) #output is 5.5
Why use it str function. It is not necessary, because input return string?