# Remember Version 3 # This program displays a series of words and asks the user # to enter a word that began with a particular letter # It displays congratualtions or condolence message # This version uses Repetition Control Structure #import time and uagui module import time,uagui #Open the window uagui.openWindow('Remember The Word',500,400) # Create instruction list instructions=['Welcome to the Remember game.', 'I will show you a series of words.', 'After showing these words,', 'I will ask you which one started with a ','particular letter and you should tell me.', 'You win if you pick the right word.', 'Otherwise you lose the game.' ] #Use Repetition Control Structure to display instructions #New statement type - for for line in instructions: uagui.drawString(line) #Prompt the player to press the enter key uagui.inputString('Press the enter key to continue') #Erase instruction and move cursor to top left corner uagui.clearWindow() uagui.movePen() #Create word list wordList=['orange','chair','mouse','sandwich'] #Display word, pause for 2 sec, clear word and move cursor
# Remember Version 3 # This program plays the Remember game where the game # displays a sequence of words and the user tries to # remember which word began with a particular letter. import time, uagui # Main Program uagui.openWindow('Remember the Word', 900, 700) uagui.setFontSize(50) uagui.drawString('Welcome to the Remember game.') uagui.drawString('I will show you a series of words.') uagui.drawString('After showing these words,') uagui.drawString('I will ask you which one started with a ') uagui.drawString('particular letter and you should tell me.') uagui.drawString('You win if you pick the right word.') uagui.drawString('Otherwise you lose the game.') uagui.inputString('Press the enter key to continue') uagui.clearWindow() uagui.movePen() # Display the words wordList = ['orange', 'chair', 'mouse', 'sandwich'] for word in wordList: uagui.drawString(word) time.sleep(2) uagui.clearWindow() uagui.movePen() playerAnswer = uagui.inputString('What word began with the letter c?') uagui.clearWindow()
def createWindow(): uagui.openWindow('Remember the Word', 900, 700) uagui.setFontSize(50)