我有一个简单的程序,但输入的问题部分没有工作,因为它应该。我只想让for循环中的"i“作为用户输入问题的一部分,打印0、1、2、3等。
而不是给出错误。
代码如下
def multapp():
score=0
lives=3
for i in range(4):
answer1=input("2 x",i)
if answer1=="2":
print("well done child")
score=score+1
else:
print("No")
lives=lives-1
print("lives:",lives)
print("score:",score)
multapp()发布于 2022-02-01 13:58:09
从输入函数中删除"2 x":
def multapp():
score=0
lives=3
for i in range(4):
answer1=input(i)
if answer1=="2":
print("well done child")
score=score+1
else:
print("No")
lives=lives-1
print("lives:",lives)
print("score:",score)
multapp()https://stackoverflow.com/questions/70941568
复制相似问题