Guessing Game - Between You and Computer

 Guess the number? 


import random

rNum = random.randint(1, 100)

while True:
    gn = int(input("We have chosen a number between 1 and 100. Guess what? "))

    if gn < rNum:
        print("Choose higer number")

    if gn > rNum:
        print("Choose lower number")

    if gn == rNum:
        print(f"You guessed it right. Your number was {gn}")
        print(f"Our chosen number was {rNum}")
        break







Comments

Popular posts from this blog

Quotation marks to wrap an element in HTML

The Basic Structure of a Full-Stack Web App

Unlocking Web Design: A Guide to Mastering CSS Layout Modes