0
4/4
does not work. I can't input answer
3 Answers
+ 13
Are you talking about a question on the Python course?
+ 4
i don't really understand what is the problem but i think a got tge idea.
Maybie when you are doing this :
a = int(input("enter a number "))
and you enter a calculation like 4/4 python doesn't understand.
If that's the case there is a very easy way in python to evaluate the value of a calculation in a string :
just use the function : eval("expression") where "expression" is a string.
for example : eval("4/4") = 1
so use:
a = eval(input("Enter a number "))
in fact input() return the user input as a string and you have just to evaluate it with eval().
hope it will help you