Skip to content

JoeWingfield/techdegree-project-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

When the game is started by calling on the start_game function, first the initial score/s is/are stored, and the value of high score is set equal to the lowest score value on the list. The start message is displayed, the answer is stored as a random number. A message depicting the current high score appears, and then a input for the guess variable asking for the players guess. If they don't submit a integer value, the try and except keywords will display a error message. The score, which counts guess attempts, is set to zero outside the while loop. The while loop runs while the answer is incorrect, and inside it uses if and elif's to determine if first of all, the player's guess is inside the 1-10 parameters, and if their guess is higher or lower than the answer. Depending on this it will give a "it's higher" or "it's lower" message based on their status and ask for more input. Everytime the player gets it wrong, their score will go up by one, indicating that an attempt has been made. An if statement outside the while loop asks if their guess is correct, and if it is it will print their score, it will add their score to the "scores" list, and will print the current high score. After this it will prompt them with a question asking if they want to play again. If they type yes it will call the start_game function and the whole process will repeat. If no or anything else is typed the game will end with a goodbye message indicating that the game is over. At the end of the code the start_game function is called so that whenever you run the program it will start the game immediately

Releases

No releases published

Packages

No packages published