Question: 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
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 Puzzle V2 Reflection Activity
Question 1 [4]
List two simple statement kinds and two compound statement kinds (excluding function definition) that were used in your V2 code. [4]
| Two simple statement kinds used: | Two compound statement kinds used: |
|
|
|
|
|
|
Question 2 [6]
Provide an example from your code for each instance of the four statement kinds you listed in Q1 in order (simple, simple, compound, compound). For the compound statements, highlight the header(s) in yellow [6]
|
|
|
|
|
|
|
|
Question 3 [3]
How would you need to modify your code if the rules for this version were changed so that you only displayed the success message if the player guessed a letter which occurred more than once in the secret word? For example, with the word kiwi, the player should see the success message if they guess an i , but not if they guess k or w. [3]
can you do the reflection activity for me?? Thanks!!!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
