我正在使用python制作一个命令行程序来计算线性方程的东西。我的函数声明之一是这样的:
def lineSub():
while true:
print("This is the Linear Equation submenu")
print("Choose and option")
print("0: exit")
print("1: input 'm' and 'b' in y=mx+b")
print("2: input 'a' , 'b' and 'c' in ax+by=c")
print("3: input a point and a slope")
print("4: input two points")
choice = getInt("Choice: ")
lineSM = {
1: yIntForm,
2: stdForm,
3: pointSlope,
4: twoPoints,
}
if choice == 0:
return 0
elif not(choice in range(0,5)):
print("That's not a choice")
else:
lineSM[choice]()
该选择将用户带到子菜单功能。每次我运行程序时,它都会显示该行
def lineSub():
是无效的语法。我不知道它有什么问题,所有其他函数定义完全相同,并且没有显示任何错误。请帮忙!