while.py 476 B

1234567891011121314151617181920
  1. number = 23
  2. running = True
  3. while running:
  4. guess = int(input('Enter an integer : '))
  5. if guess == number:
  6. print('Congratulations, you guessed it.')
  7. # this causes the while loop to stop
  8. running = False
  9. elif guess < number:
  10. print('No, it is a little higher than that.')
  11. else:
  12. print('No, it is a little lower than that.')
  13. else:
  14. print('The while loop is over.')
  15. # Do anything else you want to do here
  16. print('Done')