Entry 5696

Number Game

   

Submitted by anonymous on Aug. 1, 2010 at 7:36 p.m.
Language: Python 3. Code size: 384 bytes.

from random import randint

print("Welcome!")
secret = randint(1, 10)
g = input("Guess the number: ")
guess = int(g)

while guess != secret:
    if guess > secret:
        print("Too high")
        g = input("Guess the number: ")
        guess = int(g)
    else:
        print("Too low")
        g = input("Guess the number: ")
        guess = int(g)
print("You Win!")

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).