Answers for "how to make an number guessing game in python begniars"

3

guessing game in python

# importing random library
# this game untill work untill u get  right answer
import random
a = 1
rand = random.randint(1, 100)
while 1 <= a:
    a += 1
    winin = int(input("enter a number under 100 : "))
    if winin > 100:
        print("not valid")
        break
    else:
        if winin < rand:
            print("too low")
        elif winin > rand:
            print("too high")
        if winin == rand:
            print(f"you got the right answer in {a - 1} times")
            break
Posted by: Guest on April-11-2021

Code answers related to "how to make an number guessing game in python begniars"

Python Answers by Framework

Browse Popular Code Answers by Language