Ich habe versucht, einen einfachen Taschenrechner auf Python-GUI zu programmieren, aber ich bekomme eine Syntaxfehlermeldung. Ich bin neu im Programmieren, daher bin ich mir nicht sicher, was ich tun soll.Syntaxfehler beim Lesen von Daten mit Eingabe()
Traceback (most recent call last):
File "C:\Users\kmart3223\Desktop\Martinez_K_Lab1.py", line 126, in <module>
main()
File "C:\Users\kmart3223\Desktop\Martinez_K_Lab1.py", line 111, in main
operation = input("What operations should we do (+, -, /, *):")
File "<string>", line 1
+
^
SyntaxError: unexpected EOF while parsing
-Code
def main():
operation = input("What operations should we do (+, -, /, *):")
if(operation != '+' and operation != '-' and operation != '/' and operation != '*'):
print ("chose an operation")
else:
variable1 = int(input("Enter digits"))
variable2 = int(input("Enter other digits"))
if (operation == "+"):
print (add(variable1, variable2))
elif (operation == "-"):
print (sub(variable1, variable2))
elif (operaion == "*"):
print (mul(variable1, variable2))
else:
print (div(variable1, variable2))
main()
Python 2 oder Python 3? – erip
Sie verwenden Python 2. Verwenden 'raw_input' und nicht' input' – idjaw
Schließen Grund Typo, in einer Art und Weise gelöst .... – Drew