简单的elif语句由于需要'expression'而无法正常工作?

问题描述 投票:-6回答:3

我对编码非常陌生,只是了解基本代码。我之前做过if语句,但没有遇到过这个问题,有人可以帮忙吗?

我的代码:

print("Hello User")
myName = input("What is your name?")
print("Hello" + myName)

myAge = input("What is your age?")

if input < 17:
    print("Not quite an adult!")
elif:
    print("So you're an adult!")

https://gyazo.com/15eef7751886747f4ce572641b9398fc

python pycharm
3个回答
5
投票

您需要else:


1
投票

只需将'elif'更改为'else'。然后你就去了!


0
投票
print("Hello User")
myName = input("What is your name?")
print("Hello" + myName)

myAge = int(input("What is your age?"))

if myAge < 17:
    print("Not quite an adult!")
elif myAge >17:
    print("So you're an adult!")
© www.soinside.com 2019 - 2024. All rights reserved.