ismaelvc

number_guessing_game.py

Mar 16th, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. print('Lets play a game, think of a number and I will guess it.\n'
  2.       'Just follow the directions.\n')
  3.  
  4. user_input = input('Are you ready to play? Type y/yes or else quit. ')
  5.  
  6. valid_options = ['y', 'yes']
  7. if user_input.lower() in valid_options:  
  8.     print('\nGreat, think of a number any number.')  
  9.        
  10.     steps_list = ['Add 3 to it.', 'Double it.', 'Subtract 4 from it.',
  11.                   'Divide it by 2.', 'Subtract the original number from it.']
  12.     def next_steps():
  13.         user_prompt = 'Press any key to continue.\n'
  14.         for next_step in steps_list:
  15.             input(user_prompt)
  16.             print(next_step)            
  17.     next_steps()
  18.  
  19.     input('Press any key to continue and I will guess your number.\n')
  20.  
  21.     print('Your number is 1!')
  22.  
  23. else:
  24.     print("\nWell you're lame.\n...Bye!")
Advertisement
Add Comment
Please, Sign In to add comment