我很难让这个程序正常工作,因为输入是TypeError: 'int' object is not callable
#!/usr/bin/python3
def displaymenu():
input32=int(input("1) Run experiment\n2) Exit"))
return input32
def cal1(we,woc,wa):
wala=we*woc(wa-woc)
return wala
def cal2(wo,woh):
wolo=24*wo*woh*wa
return wolo
def cal3(wa,woc):
wele=wa**2+woc(wa-woc)
return wele
def beamere(wala,wolo,wele):
y=(wala/wolo)*wele
return y
input32 = displaymenu()
while input32 is not 2:
if input32 == 1:
we= int(input("enter your width"))
wo= int(input("enter what ever this is"))
woh=int(input("enter this thing"))
wa= int(input("i really should stop calling my varibles random sylibles"))
woc=int(input("enter your woc"))
wala = cal1(we,woc,wa)
wolo = cal2(wo,woh)
wele = cal3(wa,woc)
y = beamere(wala,wolo,wele)
print(y)
elif input32 == 2:
print("learn english")
break
else:
input32 = displaymenu()
这是由于您的
cal1
和cal3
: 在执行wala=we*woc(wa-woc)
时,您告诉python使用woc
作为函数,您可能打算使用wala=we*woc*(wa-woc)
将woc
乘以(wa-woc)
。第二个函数也是如此以下是您的函数的外观:
在函数def cal1中修改行 从
至
woc(wa woc)—>;指示参数为“wa woc”的woc函数调用
相关问题 更多 >
编程相关推荐