我只是让自己习惯于如果在python中的其他语句,但我有一些麻烦试图让我的工作,究竟发生了什么?为什么我的if else语句不正确?
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")
您不应该使用'is'来比较数字。 – JBernardo
@JBernardo,是的,但这并没有引起这个问题的问题 – Holloway
如果你正在使用它来重新检查你刚刚检查过的同样的条件,那么'elif'是多余的。 – khelwood