Ok as you said.. I believe.. But It still when option 5 is inputed, it still prints out 'You do not have enough gold' & 'Try again later' statments.. and then loops back to enter the number again.
def S():
while True:
global gold
print 'Welcome to the Shipyard!\n'
print 'Here you can buy new Ships.\n'
print 'You currently have',gold,'Gold.\n'
Shiplist = {'1)Sloop':'1500$', '2)Schooner':'3500$', '3)Brigantine':'6500$', '4)Galley': '9500$'}
print 'The current Ships avaliable:\n'
print Shiplist
print ' '
print 'To Exit type 5'
print 'Type a number to choose the corresponding Ship!\n'
try:
choice = int(raw_input('Enter Number: '))
except ValueError:
print 'Invalid Input! Please input only numbers.\n'
if choice in [1, 2, 3, 4, 5]:
global price
global ship
if choice == 1:
ship = 'Sloop'
price = 1500
elif choice == 2:
ship = 'Schooner'
price = 3500
elif choice == 3:
ship = 'Brigantine'
price = 6500
elif choice == 4:
ship = 'Galley'
price = 9500
if gold >= price:
print 'You bought a new ship!'
gold -= price
print 'You now have:',
print gold,
print 'Gold\n'
elif gold < price:
print 'You do not have enough Gold!'
print 'Try again later!\n'
elif choice == 5:
break
I know its something stupid I am not seeing, after this im going to bed, because I am nothing thinking clearly..