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>>

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

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

Microsoft Word top 180 keyboard shortcuts

Microsoft Word top 180 keyboard shortcuts Download shortcut keys File: MS Word File - Click here MS Excel File - Click here PDF File - Click...

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