Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Fri Jan 5 10:23:15 2018
- @author: 85937
- """
- #%%
- import random
- number = random.randint(1,9)
- guess = 0
- count = 0
- while guess != number and guess != "exit":
- guess = input("Your guess:")
- if guess == "exit":
- break
- guess = int(guess)
- count += 1
- if guess < number:
- print("You need a HIGHER number:")
- elif guess > number:
- print("You need a LOWER number:")
- else:
- print("Correct, you guessed", number, "in only", count,"tries")
Add Comment
Please, Sign In to add comment