Python 如何检查字符串是否不等于某个值?
这是我到目前为止问卷的编码。在第6行,如果用户输入的字符集不是1234,我如何使其打印无效Python 如何检查字符串是否不等于某个值?,python,Python,这是我到目前为止问卷的编码。在第6行,如果用户输入的字符集不是1234,我如何使其打印无效 print ("Welcome, Please enter your Canadian Armed Forces Identification Number") answer = raw_input() if answer == ("1234"): print " Please identify yourself " elif answer == "": print " Inv
print ("Welcome, Please enter your Canadian Armed Forces Identification Number")
answer = raw_input()
if answer == ("1234"):
print " Please identify yourself "
elif answer == "":
print " Invalid ID "
print " 3 More attempts before termination of program "
name= raw_input()
if answer == ("Silva"):
print " Welcome, Silva "
我怎样才能让它重复,直到正确的数字是正确的?如果用户再次输入错误3次,我将如何使程序终止?这是两个不同的问题。我建议你选一本教你所有基本知识的书。好的,非常感谢你
if answer == ("1234"):
print " Please identify yourself "
else:
print " Invalid ID "
print " 3 More attempts before termination of program " name= raw_input()