0

PYTHON GHETTO CALCULATOR

can someone tell me what’s wrong here? I need to make “Process” be a a string stored value by the users. I tried taking the str() function out but still won’t run properly. Traceback (most recent call last): File "ForLoop.py", line 3, in <module> PROCESS=str(input("ENTER WHAT YOU WOULD LIKE TO DO (+,-,*,/,**,%):")) File "<string>", line 1 * ^ SyntaxError: unexpected EOF while parsing

4th Jan 2018, 9:07 AM
Jalomo
Jalomo - avatar
4 Answers
+ 1
you do not need the str() function anymore cz the PROCESS itself as a raw input is already a string. I guess that’s why u got errors
4th Jan 2018, 9:12 AM
monotom
monotom - avatar
0
I take it off and still get this: Traceback (most recent call last): File "ForLoop.py", line 3, in <module> PROCESS=input("ENTER WHAT YOU WOULD LIKE TO DO (+,-,*,/,**,%):") File "<string>", line 1 * ^ SyntaxError: unexpected EOF while parsing
4th Jan 2018, 9:25 AM
Jalomo
Jalomo - avatar
0
are u sure this code resulted the error on line 1. i’ve just run it and it works TOTALLY fine. just check it. i think it’s bcz your previous input. if anything further, i won’t mind giving a hand
4th Jan 2018, 10:41 AM
monotom
monotom - avatar
0
ENTERED_NUM= int(input("THIS IS QUICK MATHS..enter a number:")) PROCESS=input("ENTER WHAT YOU WOULD LIKE TO DO (+,-,*,/,**,%):") ENTERED_NUM2=int(input("enter second number:")) if PROCESS=="+": print(ENTERED_NUM+ ENTERED_NUM2) elif PROCESS=="-": print(ENTERED_NUM-ENTERED_NUM2) elif PROCESS=="/": print(ENTERED_NUM/ENTERED_NUM2) elif PROCESS=="*": print(ENTERED_NUM* ENTERED_NUM2) elif PRCOESS=="**": print(ENTERED_NUM** ENTERED_NUM2) elif PROCESS=="%": print(ENTERED_NUM% ENTERED_NUM2)
4th Jan 2018, 10:29 PM
Jalomo
Jalomo - avatar