print "You've entered a wording system!"
print "What words do you want?"
while False:
word1 = raw_input('enter your word:')
word2 = raw_input('enter your word:')
print word1
print word2
if len(word1)>len(word2):
word_difference = len(word1) - len(word2)
print word1, "is", word_difference, "letters longer than", word2
elif len(word2)>len(word1):
word_difference = len(word2) - len(word1)
print word2, "is", word_difference, "letters longer than", word1
elif len(word1) == len(word2):
print word1, "has same number of letters as", word2
repeat = raw_input("Would you like to enter two more words?(y/n)")
if repeat == "y":
y == False
,所以我想,如果這個問題問你創建從word1 = raw input
重複到repeat = raw_input(asking fort two more words)
一個代碼,如果no == Good bye!
我想知道如何在Python中重複一個過程?
你已經告訴你如何編寫一個while循環...爲什麼不使用另一個? – James 2014-09-10 13:00:28
'while False'永遠不會被執行,因爲它是,呃,不是True。 – cdarke 2014-09-10 13:00:32
它看起來像所有的代碼應該在第一個循環中,只要'repeat'等於「y」(在循環之前已經適當地初始化了'repeat'),它應該執行。 – chepner 2014-09-10 13:03:46