1 introduction
Python The classic number guessing game , Almost everyone can do it when they learn programming , It is also a small way of entertainment .
2 Problem description
Example : The computer randomly generates 1-100 Integer between , Let users guess , When you guess wrong , You will be prompted to guess
Is the number big or small , Until the user guesses right , The game is over .
Input : The first line of input gives a value that does not exceed 100 The positive integer , This number is randomly generated by the game
A number ; Then let the user enter a number .
Output : The user input number and random number are output at the same time “ Congratulations on your guesses !”
3 Algorithm description
The number guessing game is to make the computer randomly generate a 100 Integer within , The user enters a number to guess it , And prompt ‘Too Big’ perhaps ‘Too Small’, Equality means you have guessed . If you guess , Then end the program .
4 Conclusion
The game uses the knowledge of loop statements and conditional statements . For starters , Give it a good knock , Can consolidate the knowledge in this field .
The attachment
import random