fork download
  1. class Gymnast_room():
  2. def enter(self):
  3. print "This is the gymnastics room, we got foam pits and rings!"
  4. print "Before you can enter, you have to enter the code"
  5. guess = int(raw_input('What is the code? >>'))
  6.  
  7. passcodes = {'Gymnast_code': 1234,
  8. 'Powerlifting_code': 1234
  9. }
  10. while guess != passcodes['Gymnast_code']:
  11. guess = int(raw_input('What is the code? >>'))
  12. if guess == passcodes['Gymnast_code']:
  13. print "Correct!"
  14. return 7
  15. else:
  16. print "Incorrect!"
  17.  
  18. Gymnast_room().enter()
  19.  
Success #stdin #stdout 0.08s 8840KB
stdin
5
5
7
9
1234
stdout
This is the gymnastics room, we got foam pits and rings!
Before you can enter, you have to enter the code
What is the code? >>What is the code? >>Incorrect!
What is the code? >>Incorrect!
What is the code? >>Incorrect!
What is the code? >>Correct!