我正在努力为我的一个课程完成一个程序,但是我一直得到无效的语法,python对我来说是非常新的,所以请忍受我的无知。
无效语法在冒号“if guess ==(num_x + num_y)”中冒出来:“
如果有人可以帮助,我会非常感激。
更新*
修正了括号谢谢你abarnert,但现在我有以下SyntaxError
Traceback (most recent call last):
File "C:\Users\Franz\Desktop\randomstudy.py", line 48, in
main()
File "C:\Users\Franz\Desktop\randomstudy.py", line 25, in main
guess=int(input(num_x, "-", num_y, "=\n"))
TypeError: input expected at most 1 arguments, got 4我更新了下面的代码以包含括号。
def main():
import random
num_x=random.randint(-50,50)
num_y=random.randint(-50,50)
op=random.randint(0,3)
control=True
print("Welcome! Here is your random problem:\n")
if op==0:
while True:
guess=int(input(num_x, "