Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- text = input()
- total = 0
- pattern = r"%([A-Z][a-z]+)%<(\w+)>\|(\d+)\|(\d+\.\d+)\$"
- while True:
- if text == "end of shift":
- break
- result = re.findall(pattern, text)
- if result:
- for i in result:
- name = i[0]
- item = i[1]
- bill = int(i[2]) * float(i[3])
- total += bill
- print(f"{name}: {item} - {bill:.2f}")
- text = input()
- print(f"Total income: {total:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement