python - Checking through a variable to see if it doesn't contains anymore strings -
def main(): #word = input("word guess player 2:") word = ['h','e','l','l','o'] word2 = "hello" #make list of _ same length word display =[] in range (0,len(word)): display.append("_") chances = int(input("number of chances guess word:")) if len(word)== 11: print ("your word long. has 10 charecters or less") else: word = word if chances < len(word): answer = input("your word {0} letters long , sure don't want more chances? yes or no?". format (len(word))) if answer == "no": chances= int(input("number of chances:")) else: chances = chances ("ok lets continue game") print ("player 2, have {0} chances guess word.". format (chances)) won = false underscore = false while chances > 0 , won == false , underscore == false: guess = input("enter guess: ") gc=false in range (0,len(word)): if guess == word[i]: gc=true display[i]=guess if not gc: chances = chances - 1 display2 = "" in display: display2 = display2 + + " "
for reason code doesn't work when state while loop game continues go on until user runs out of guess'. have suggestions how can fix this?
you never set won
true when user wins game guessing letters.
Comments
Post a Comment