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
3 Antworten
+ 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))
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
0
thanks ulisess cruz and markus kaleton