Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- regex = r">>([A-Za-z]+)<<([0-9]+\.?[0-9]*)?!(\d+)\b"
- total_furniture = []
- total_price = 0
- while True:
- command = input()
- if command == "Purchase":
- break
- data = re.findall(regex, command)
- if data:
- furniture, price, count = data[0]
- total_furniture.append(furniture)
- total_price += float(price) * float(count)
- print('Bought furniture:')
- for i in total_furniture:
- print(i)
- print(f"Total money spend: {total_price}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement