我是Python编程新手。我正在尝试编写我的代码,以便在输入年龄时打印一系列文本。但是,我的代码只能工作,如果我按照它逐行。例如,当我输入年龄2000+时,什么都不会发生。我需要先输入一个整数小于12,其次是整数比2000年Python - 基本编码
print('Please input name')
if input() == 'Alice':
print('Hi, Alice.Please input age')
if int(input()) < 12:
print('You are not Alice, kiddo.')
elif int(input()) > 2000:
print('Unlike you, Alice is not an undead, immortal vampire.')
elif int(input()) == 100:
print('You are not Alice, grannie.')
elif 12 < int(input()) < 99:
print('You are Alice!.')
每次不要重复输入,将其分配给一个变量,比较变量 – PRMoureu
如果你有你的答案,然后将其关闭。 – cSharma