This document outlines the requirements and algorithm for a number guessing game that allows a user 7 attempts to guess a randomly generated secret number. It must provide feedback on whether guesses are too high or low, and display the secret number and incorrect guess sequence if the user does not guess correctly within 7 tries. The user is also given an option to replay the game with a new randomly generated number.
This document outlines the requirements and algorithm for a number guessing game that allows a user 7 attempts to guess a randomly generated secret number. It must provide feedback on whether guesses are too high or low, and display the secret number and incorrect guess sequence if the user does not guess correctly within 7 tries. The user is also given an option to replay the game with a new randomly generated number.
This document outlines the requirements and algorithm for a number guessing game that allows a user 7 attempts to guess a randomly generated secret number. It must provide feedback on whether guesses are too high or low, and display the secret number and incorrect guess sequence if the user does not guess correctly within 7 tries. The user is also given an option to replay the game with a new randomly generated number.
Create a function to get user input. There should be correct symbol for greater than or less than the secret number. Give the user 7 attempts to get the correct answer. If user did not guess correctly give them a incorrect sequence and display hidden number. Give option to replay a new game.
Develop Phase:
Algorithm
1. Import random library.
2. Generate a random no. 3. User greeting (explain game) 4. User input 5. Check user input against the random no. 6. Determine greater or less than or equal to. 7. Output appropriate message to user. 8. Add 1 to number of total guesses. 9. Check total guesses is not greater than 7. 10. If answer is correct end program 11. If it is not correct than give 7 chances. 12. After that give the hidden no. with incorrect sequence. 13. Give option to replay a new game.