4/13/2024 0 Comments Hangman copy paste text art![]() ![]() Wait() add_letter() wrong_letter() parts(len(wrong)) elif guess not in picked: print("Let me check") wait() if guess in wrong: print("You already guessed", guess) wrong_letter() else: print(guess, "is not in my word") wrong. #List of words file = open("words.txt", "r") words_list = file.read().split('\n') Wait() add_letter() wrong_letter() parts(len(wrong)) elif guess not in picked: print("Let me check") wait() if guess in wrong: print("You already guessed", guess) wrong_letter() else: print(guess, "is not in my word") wrong.append(guess) add_letter() wrong_letter() parts(len(wrong)) if len(wrong) > 4: print("Game Over!") print("I picked", picked) break if '_' not in right: print("You guessed it!") print("I picked", picked) break #Handles letter that appear more than once index = 0 for i in picked: if i = guess: right = guess index = index + 1 #Main Loop while True: print('=') guess = input("Guess a letter") if guess in picked: print("Let me check") A quick solution to your immediate problem is a helper function: def put(text): print 't' + text. #Prints out wrong letters def wrong_letter(): print("Wrong letters:", end = "") for i in wrong: print(i,' ',end = "") print() #Prints letters in right with _'s def add_letter(): for i in right: print(i, ' ', end = "") print() #Creates a list with _ marks for letters right = * len(picked) wrong = Print("The word has", len(picked), "letters")įor i in range(len(picked)): print('_',' ', end = "") print() #Wait time function def wait(): for i in range(5): print('.', end = "") sleep(.5) print() wait() #Hangman from time import sleep import random from hangman_parts import parts ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |