Skip to content

Latest commit

 

History

History
14 lines (14 loc) · 385 Bytes

File metadata and controls

14 lines (14 loc) · 385 Bytes

import random number = random.randint(1, 100) attempts = 0 # count no of attempts to guess the number guess = 0 while guess != number: guess = eval(raw_input('Guess a number: ')) attempts += 1 if guess == number: print 'Correct! You used', attempts, 'attempts!' break elif guess < number: print 'Go higher!' else: print 'Go lower!'