判断语句问题
while True:answer=input("can i exit?\n")
if answer.lower() == "ok"
break
print("i am tired") if answer.lower() == "ok":
加个冒号 if 后面漏了个冒号,这样即可:
while True:
answer=input("can i exit?\n")
if answer.lower() == "ok":
break
print("i am tired") while True:
answer=input("can i exit?\n")
if answer.lower() == "ok":
break
print("i am tired")
页:
[1]