Hello, I'm a beginner using Python 3.3.3. I'm working on a little text-based rpg using the skills I've learned thus far, but am wondering what the problem is with my code. When I enter the first input response, like 1, everything seems to be fine, but when I enter 2, I have to type it twice, and 3, I have to type it in thrice just to get to the next step in the code. The class code is below:
import random
class City(object):
def __init__(self,name,size):
self.size = size
self.name = name
def cityMenu(self):
print('What will you do?')
print('''1 - Visit the tavern
2 - Visit the inn
3 - Visit City Hall''' )
if input()=='1':#This is fine.
print('Okay, you\'re heading to {}\'s tavern.'.format(self.name))
elif input()=='2':#This has to be typed in twice.
print('Okay, you\'re heading to {}\'s inn.'.format(self.name))
elif input()=='3':#This has to be typed in three times.
print('Okay, you\'re heading to {}\'s city hall.'.format(self.name))
else:#Four times.
self.cityMenu()
def exploreCity(self):#maybe use this after a convo at the inn or city hall
while True:
print('Explore the outer limits of {}? Y or N?'.format(self.name))
if input().lower().startswith('y'):#This seems to be fine.
random.randint(0,10)
if random.randint(0,10) >= 0:
print('Nice.')
break
elif input().lower().startswith('n'):#This has to be typed in twice.
print('Well, okay then.')
break
else:
print('Please choose a proper command.')
Firhaven = City('Firhaven','The city of fortitude.')
Triae = City('Triae','The city of intellect.')
Cavana = City('Cavana','The city of strength.')
Silvercity = City('Silvercity','The city of light.')
print('You have reached {}, {}'.format(Firhaven.name,Firhaven.size))
Firhaven.cityMenu()
Firhaven.exploreCity()