Question: Here are the code for my program. Can you change it into the complete version? Like the one in the picture. Thank you. import uagame
Here are the code for my program. Can you change it into the complete version? Like the one in the picture. Thank you.
import uagame import random
def main(): #set up the list list_of_words=["apple","banana","kiwi","mango","pineapple","watermelon"] word=random.choice(list_of_words) print(word) list1=[] count=0 for x in word: list1.append(x) count=count+1 # create window screen_width=500 screen_height=400 window = uagame.Window("Word Puzzle", screen_width, screen_height) # Display instructions y_coord=0 window.draw_string("I am thinking of a secret word",0,y_coord) font_height=window.get_font_height() y_coord=y_coord+font_height window.draw_string("Try and guess the word. You can guess one letter at a time.",0,y_coord) y_coord=y_coord+font_height window.draw_string("Each time you guess I will show you",0,y_coord) y_coord=y_coord+font_height window.draw_string("which letters have been correctly guessed and which",0,y_coord) y_coord=y_coord+font_height window.draw_string("letters are still missing. You will have 4 guesses to",0,y_coord) y_coord=y_coord+font_height window.draw_string("guess all of the letters.Good luck!",0,y_coord) y_coord=y_coord+font_height window.draw_string("The answer so far is: "+ "_ "*count,0,y_coord) y_coord=y_coord+font_height #Input answer guess=window.input_string("Guess a letter: ",0,y_coord) y_coord=y_coord+font_height letter=list(word) underline=list('_ '*count) #check answer if guess in letter: for x in range(len(letter)): if guess == letter[x]: underline[x] = guess final_answer = ''.join(underline) y_coord=y_coord+font_height window.draw_string("The answer so far is: "+final_answer+"",0,y_coord) y_coord=y_coord+font_height window.input_string("Good job! You found the word "+word+"",0,y_coord) y_coord=y_coord+font_height window.input_string("Press enter to end the game",0,y_coord) window.close() else: window.draw_string("The answer so far is: "+"_ "*count,0,y_coord) y_coord=y_coord+font_height window.draw_string("Not quite, the correct word was "+word+"",0,y_coord) y_coord=y_coord+font_height window.input_string("Press enter to end the game",0,y_coord) window.close() main()


Word Game I'm thinking of a secret word. Try and guess the word. You can guess one letter at a time. Each time you guess l will show you which letters have been correctly guessed and which letters are still missing. You will have 4 guesses to guess all of the letters. Good luck! The answer so far IS Quess a letter (4 guesses remaining): m The answer so far IS.m Quess a letter (4 guesses remaining): g The answer so far is. M Quess a letter (4 guesses remaining): o The answer so far IS.m Quess a letter (4 guesses remaining): n The answer so far IS.m n go Quess a letter (4 guesses remaining): m The answer so far IS.m n go Quess a letter (3 guesses remaining): ia The answer so far IS.m a n go Qood job! You found the word mango! Press enter to end the game 0 Word Game I'm thinking of a secret word. Try and guess the word. You can guess one letter at a time. Each time you guess l will show you which letters have been correctly guessed and which letters are still missing. You will have 4 guesses to guess all of the letters. Good luck! The answer so far IS Quess a letter (4 guesses remaining): m The answer so far IS.m Quess a letter (4 guesses remaining): g The answer so far is. M Quess a letter (4 guesses remaining): o The answer so far IS.m Quess a letter (4 guesses remaining): n The answer so far IS.m n go Quess a letter (4 guesses remaining): m The answer so far IS.m n go Quess a letter (3 guesses remaining): ia The answer so far IS.m a n go Qood job! You found the word mango! Press enter to end the game 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
