Why won't this work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why won't this work?

I have tested this code in an IDE and it works but it won't on the SoloLearn IDE, it is a calculator. equation = input() print(equation) legal_chars = set("0123456789-+*/()")

19th Sep 2018, 1:20 PM
Jackson C
Jackson C - avatar
6 Answers
+ 2
the code you provided doesn't seem finished
19th Sep 2018, 1:57 PM
hinanawi
hinanawi - avatar
+ 1
Jackson C cause the code in this post doesn't actually calculate anything, just prints the input
19th Sep 2018, 8:50 PM
hinanawi
hinanawi - avatar
+ 1
Jackson C i don't see how that would calculate anything, there's no math in the code whatsoever, did you mean "print(eval(equation))"?
19th Sep 2018, 8:52 PM
hinanawi
hinanawi - avatar
0
why is that
19th Sep 2018, 8:49 PM
Jackson C
Jackson C - avatar
0
i know that is why i posted this because when i ran it on my desktop it gave me the answer but on here it just wrote the equatipn again
19th Sep 2018, 8:51 PM
Jackson C
Jackson C - avatar
0
hinanawi i just now realized i wrote the program in python 2.7 and sololearn uses 3 sorry for wasting you time
20th Sep 2018, 4:05 PM
Jackson C
Jackson C - avatar