0

Wrong output

wrong output which are expected when using math module in python3 # i want output is 60 # but in my code is 20*3 # previous i wrote in python2 , it running as well # now i trying write in python, an error occured https://code.sololearn.com/cbYl68H6jubq/?ref=app # I used module math in python3 # should if i input 20*3 , output must be 60 # but my output remains 20*3 code: from math import* while True : varBil = input("_>") if varBil == "" : break

28th Aug 2018, 8:54 PM
Sukma-chan
Sukma-chan - avatar
3 odpowiedzi
+ 2
Sukma-chan input returns a string. if you want you can use eval to evaluate an expression in the string returned: varBil = input("_> ") print(eval(varBil))
28th Aug 2018, 9:09 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
to add to the above comment. In Sololearn/in this case, while loop will return eof error unless you leave an empty space to the input lines
29th Aug 2018, 4:26 AM
Markus Kaleton
Markus Kaleton - avatar
0
thanks ulisess cruz and markus kaleton
3rd Sep 2018, 8:15 PM
Sukma-chan
Sukma-chan - avatar