Python Number Guessing Game

 


Python Number guessing Game

We create a Number Guessing Game using Random Module. If you learn Random Module then back little bit.

Example:

Write the code for number guessing program and enjoy it.

while True:
   
import random
    cn=random.randrange(
0,9)
    choice=input(
"If you are quit then type 'Q' or 'q' other wise press Enter----")
   
if choice=="Q" or choice=="q":
       
break
   
un=int(input("Guess a Number: "))
   
if un>cn:
        print(
"Draw Number is: ",cn)
        print(
"Sorry, Your guess Number is Too High.")
   
elif cn>un:
        print(
"Draw Number is: ", cn)
        print(
"Sorry, Your guess Number is Too Low.")
   
else:
        print(
"Draw Number is: ", cn)
        print(
"Congrutulation, You Win")

<<Try yourself>>

Learn Random Module then click previous button

 <<Previous                                                  Next>>

कोई टिप्पणी नहीं

टिप्पणी: केवल इस ब्लॉग का सदस्य टिप्पणी भेज सकता है.

MS Excel to WhatsApp Bulk Message in single Click

Excel to WhatsApp Bulk Message VBA Code File Download VBA Note Pad File - Click here Download Excel Practice File - Click here Copy Code her...

Blogger द्वारा संचालित.