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

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

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

Send Multiple Emails From Excel | Send Bulk Mail from Excel Sheet with Attachment in One Click

Send Multiple Emails From Excel | Send Bulk Mail from Excel Sheet with Attachment in One Click Download VBA Code Notepad file - Click here D...

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