Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enter_sum = float(input())
- all_shopping_sum = 0
- all_shopping_pieces = 0
- price_of_item = 0
- command = input()
- while command != 'mall.Enter':
- command = input()
- command = input()
- while command != 'mall.Exit':
- all_shopping_pieces += 1
- for i in range(len(command)):
- b = ord(command[i])
- if 65 <= b <= 90:
- price_of_item = b * 0.5
- elif 97 <= b <= 122:
- price_of_item = 0.3 * b
- elif command[i] == '%':
- price_of_item = 0.5 * (enter_sum - all_shopping_sum)
- elif command[i] == '*':
- price_of_item = -10
- all_shopping_sum += price_of_item
- if all_shopping_sum > enter_sum:
- all_shopping_sum -= price_of_item
- all_shopping_pieces -= 1
- price_of_item = 0
- i += 1
- command = input()
- if all_shopping_pieces <= 0:
- print(f'No purchases. Money left: {(enter_sum-all_shopping_sum):.2f} lv.')
- else:
- print(f'{all_shopping_pieces} purchases. Money left: {(enter_sum-all_shopping_sum):.2f} lv.')
Add Comment
Please, Sign In to add comment