我对编码非常陌生,只是了解基本代码。我之前做过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!")
您需要else:
。
只需将'elif'更改为'else'。然后你就去了!
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!")