Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- health = 100
- coins = 0
- line = input().split('|')
- is_killed = False
- for i in range(len(line)):
- tokens = line[i].split(' ')
- command = tokens[0]
- number = int(tokens[1])
- if command == 'potion':
- if health + number > 100:
- number = 100 - health
- health = 100
- else:
- health += number
- print(f'You healed for {number} hp.')
- print(f'Current health: {health} hp.')
- elif command == 'chest':
- coins += number
- print(f'You found {number} bitcoins.')
- else:
- health -= number
- if health > 0:
- print(f'You slew {command}.')
- else:
- i += 1
- print(f'You died! Killed by {command}.')
- print(f'Best room: {i}')
- is_killed = True
- break
- if not is_killed:
- print("You've made it!")
- print(f'Bitcoins: {coins}')
- print(f'Health: {health}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement