import random import time def GetNumber(): number = random.randint(0,10) return number while True: y = 1 x = 1 while y == 1: number = GetNumber() while x == 1: print 'Guess the number between 0 and 10' Guess = input('') if Guess < 0: print 'You entered a negative number! The number is not a negative!' time.sleep(1) print 'Guess the number between 0 and 10' time.sleep(1) elif Guess < number: print 'Your guess is wrong! You guessed lower than the number' time.sleep(1) elif Guess > number: print 'Your guess is wrong! You guessed higher than the number' time.sleep(1) elif Guess == number: time.sleep(1) print 'Congratulations! You guessed correctly!' time.sleep(1) print 'Would you like to go again?' print '[1] Yes' print '[2] No' answer = input('') if answer == 1: break else: time.sleep(1) print 'Thank you for playing! Hope to see you again soon!' time.sleep(1) quit()