[英]Invalid syntax occurring in my python code
所以,我一直在编写代码,但遇到了问题。 我会得到一个无效的语法。 我怎样才能解决这个问题?
print ("Ok, type away")
number1 = input("Input the first number \n")
symbol = input("Input your desired operation (+,-,*,/) \n")
number2 = input("Input the second number \n")
if symbol == "+":
output = (int(number1) + int(number2))
elif symbol == "-":
output = (int(number1) - int(number2))
elif symbol == "*":
output = (int(number1) * int(number2))
elif symbol == "/":
output = (int(number1) / int(number2))
else:
print ("Something went wrong, ty again")
number1 = input("Input the first number \n")
symbol = input("Input your desired operation (+,-,*,/) \n")
number2 = input("Input the second number \n")
if symbol == "+":
output = (int(number1) + int(number2))
elif symbol == "-":
output = (int(number1) - int(number2))
elif symbol == "*":
output = (int(number1) * int(number2))
elif symbol == "/":
output = (int(number1) / int(number2))
print ("I'm thinking, Please be Patient")
time.sleep ((random.randint(2,9))
print ((output))
注意:这是最后一次打印。
最后一个print
之前的行有不平衡的括号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.