i have added a change to my while loop and i want it to add the change but show what i have added

77 views Asked by At
print('Welcome to Loot Box Simulator!')

gems = 0
boxes = 0
boxes_opened = 0
gem_cost = 19.95
gem_amount = 550
box_cost = 100
items = list

choice = ('')
while True :
    print ('You have',gem_amount, 'gems and', boxes, 'Loot boxes.')
    print ('Choose from the following options:')
    print ('1) Buy gems', gem_amount, 'gems for just', gem_cost)
    print ('2) Buy loot box (costs', box_cost, 'gems)')
    print ('3) Open loot box')
    print('4) View statistics')
    print('5) Quit')
    break
a = gem_amount + gems
if input == 'a':
    gems = gems+550
    print ('a',gem_amount)
    print ('Thank you for you purchase!')

after the 550 is added i would like the questions to re appear with 550 added to the gem amount? i would like it to reappear with you have 550 gems and 0 loot boxes and the game will request the person to choose again.

1

There are 1 answers

0
Hakens On

If i understand your question right:

print('Welcome to Loot Box Simulator!')

gems = 0
boxes = 0
boxes_opened = 0
gem_cost = 19.95
gem_amount = 550
box_cost = 100
items = list

choice = ('')
while True :
    print ('You have', gems, 'gems and', boxes, 'Loot boxes.')
    print ('Choose from the following options:')
    print ('1) Buy gems', gem_amount, 'gems for just', gem_cost)
    print ('2) Buy loot box (costs', box_cost, 'gems)')
    print ('3) Open loot box')
    print('4) View statistics')
    print('5) Quit')
    a = gem_amount + gems
    if input() == 'a':
        gems += 550
        print (a, gem_amount)
        print ('Thank you for you purchase!')

You displays before amount of gems in shop, just change to 'gems' in first print, and put if with input to loop, program will wait for input every time