我试图在 while-loops 条件语句中使用字典键,程序不会将任何输入识别为“正确”
class Gymnast_room(KeyCode):
def enter(self):
print "This is the gymnastics room, we got foam pits and rings!"
print "Before you can enter, you have to enter the code"
guess = int(raw_input('What is the code? >>'))
passcodes = {'Gymnast_code': 1234,
'Powerlifting_code': 1234
}
while guess != passcodes['Gymnast_code']:
guess = int(raw_input('What is the code? >>'))
if guess == passcodes['Gymnast_code']:
print "Correct!"
return Powerlifting_room()
else:
print "Incorrect!"