def code_breaker(): print (`MENU! n`) option1=print(`1: Play the game n`) option2=print(`2: View clues n`) option3=print(`3: See example code - Solved words n`) option4=print(`4: Exit the game n`) choice=int(input(` Which option would you like? :`)) ``` Code by harley bell ``` if choice == 1: playing() elif choice == 2: view_clues() elif choice == 3: solved() elif choice == 4: close_game() ``` Code by harley bell ``` def close_game(): print(`n You have chosen to exit the game, thankyou n`) print(`n Come back if you would like to try the game again n`) print(`n Bye n`) def view_clues(): word_filename = `N:/Computer Science/Controlled assesment/clues.txt` # This opens a .txt file in my documents word_file = open(word_filename, `r`) word = `` line = word_file.readline() while line != : word = word + line line = word_file.readline() ``` Code by harley bell ``` print(word) word_file.close() def solved(): print(`n`) print(`Your random solved word is ... n`) import random solvedwords = [ `ACQUIRED`, `ALMANAC`, `INSULT`, `JOKE`, `HYMN`, `GAZELLE`, `AMAZON`, `EYEBROWS`, `AFFIX`, `VELLUM`] print(random.choice(solvedwords)) def playing(): print(`n`) print(`All chosen letters to be inputted via CAPITAL`) print(`Your random word is ... n`) import random words = [ `#+/084&`, `#3*#%#+`, `8%203:`, `,1$&`, `!- %`, `.#7&33&`, `# #71%`, &-&641`2, `#))85`, `9&330*` ] print(random.choice(words))
©