Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- data = input()
- money_spend = 0
- furniture_list = []
- while True:
- if data == "Purchase":
- break
- pattern = r">>([a-zA-Z]+)<<(\d+|\d+\.\d+)!(\d+)"
- furniture_data = re.match(pattern, data)
- if furniture_data is not None:
- furniture = furniture_data[1]
- price = float(furniture_data[2])
- quantity = float(furniture_data[3])
- furniture_list.append(furniture)
- money_spend += price * quantity
- data = input()
- print("Bought furniture:")
- for i in furniture_list:
- print(i)
- print(f"Total money spend: {money_spend}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement