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

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

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

How To Convert Data in Columns into Rows in Excel Document

How To Convert Data in Columns into Rows in Excel Document Download Notepad file - Clickhere Copy code here: Function SplitCellToRows(CellVa...

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