Tim*_*ras 0 python if-statement input
我只是习惯了如果在python中使用if语句但是我在尝试让我的工作时遇到了一些麻烦,到底发生了什么?
x = input("Enter your string")
while not set(x).issubset({'m', 'u', 'i'}):
print("false")
x = input("Enter your string")
else:
print("Your String is " + x)
Question = int(input("Which rule would you like to apply? enter numbers 1-4: "))
if Question is 1:
print("hello")
'''issue arises in the else area below'''
else if Question is not 1:
print("other")
Run Code Online (Sandbox Code Playgroud)
在Python中,你else if不像在C++中那样写.您编写elif为特殊关键字.
if Question is 1:
print("hello")
elif Question is not 1:
print("other")
Run Code Online (Sandbox Code Playgroud)