Python guessing number game, with source code and software download link !

The source code is as follows:

print ( " Guess the number game description: 1. Every time you open this program, the system will randomly generate an integer between 0 and 100; " )
 print ( "               2. You can guess what the number is, if you guess wrong, there will be a prompt Oh, until you guess right; " )
 print ( "               3. Tell you a little trick, every time you guess the middle number, you can quickly narrow the scope, good luck! " )
 #Import random number module 
import random,os
rand_num = random.randint(0,100 )
 #Catch exception 
try :
    input_num = int(input( " Please enter a number: " ))
 except ValueError:
    input_num = int(input( " Please input the correct integer: " ))
 #Conditional judgment on the input number and random number 
while input_num != rand_num:
     if input_num > rand_num:
         print ( " greater than random number " )
     else :
         print ( " less than random " )
     try :
        input_num = int(input( " Please enter the number again: " ))
     except ValueError:
        input_num = int(input( " Please enter the correct integer: " ))
 else :
     print ( " \nCongratulations on your guess!\n " )

#Software information 
print ( " \nVersion: 18.4.3\nSize: 5.22MB\nCategory: Game\nSoftware platform: windows\nDeveloper: ChenBin\n " )
 #Prevent the software program from flashing when running 
os.system( " pause " )

 

The program has been converted into exe format, software download link: https://pan.baidu.com/s/1RnfHvvVzuh3JoeovbvnSvQ Password: 87dd

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325561256&siteId=291194637