我遇到了問題,其中包括Python中while
循環的多個語句。它適用於單個條件,但是當我包含多個條件時,循環不會終止。我在這裏做錯了什麼?python中的while循環的多個條件
name = raw_input("Please enter a word in the sentence (enter . ! or ? to end.)")
final = list()
while (name != ".") or (name != "!") or (name != "?"):
final.append(name)
print "...currently:", " ".join(final)
name = raw_input("Please enter a word in the sentence (enter . ! or ? to end.)")
print " ".join(final)
是我的錯。感謝您的幫助,雖然...工作很好 – upendra 2014-10-26 21:43:50