【发布时间】:2020-08-07 03:11:52
【问题描述】:
为什么 python 要求我输入 3 次才能告诉我“你不是 Alice!”
print('What is your name')
input() #allows user to input their name
if input() == 'Alice':
print('Hi, Alice. What is your age?')
age = input()
if age < 12:
print('you are not Alice!')
elif age > 300:
print ('unlike you, Alice isnt an undead, Immortal vampire')
【问题讨论】:
-
你给
input打了多少次电话?你对它提供给你的数据做了什么? -
不要多次使用
input(),将第一个input()赋给一个变量 -
python 不需要你在这里做任何事情。这一切都是你自己做的
-
input() #allows user to input their name if input() == 'Alice':您需要在此处输入您的姓名两次,因为您希望用户输入两次。
标签: python python-3.x loops input logic