Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- events = input().split('|')
- energy = 100
- coins = 100
- is_break = False
- for i in range(len(events)):
- event = events[i].split('-')
- if event[0] == 'rest':
- if energy + int(event[1]) > 100:
- event[1] = 100 - energy
- energy += int(event[1])
- print(f'You gained {event[1]} energy.\nCurrent energy: {energy}.')
- elif event[0] == 'order':
- if energy - 30 >= 0:
- coins += int(event[1])
- energy -= 30
- print(f'You earned {int(event[1])} coins.')
- else:
- energy += 50
- print('You had to rest!')
- else:
- if coins - int(event[1]) > 0:
- coins -= int(event[1])
- print(f'You bought {event[0]}.')
- else:
- print(f'Closed! Cannot afford {event[0]}.')
- is_break = True
- break
- if is_break == False:
- print(f'Day completed!\nCoins: {coins}\nEnergy: {energy}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement