Secret Number | Skillshare Projects

40

3

Secret Number

print("Try to quess a number between 1 and 100, the program will guide you.")

import random #random number library

Number = 0

secretNumber = (random.randint(0,100)) #you can enter a number instead of the random

while Number != secretNumber :
    Number = int(input("enter a number between 1 and 100: "))
    if (Number > secretNumber):
        print("Try lower")
        continue
    elif (Number < secretNumber):
        print("Try higher")
    continue
    elif (Number == secretNumber):
        print("Congratulations! You quessed the number!")
        break

Comments

Please sign in or sign up to comment.