0

4/4

does not work. I can't input answer

15th Apr 2017, 7:12 PM
Š›ŠµŠ¾Š½ŠøŠ“ Š‘Š»Š¾Ń…ŠøŠ½
Š›ŠµŠ¾Š½ŠøŠ“ Š‘Š»Š¾Ń…ŠøŠ½ - avatar
3 Answers
+ 13
Are you talking about a question on the Python course?
15th Apr 2017, 7:17 PM
Michael Foster
Michael Foster - avatar
+ 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
15th Apr 2017, 8:59 PM
Glozi30
Glozi30 - avatar