Skip to content

Instantly share code, notes, and snippets.

@norm
Created August 18, 2022 08:25
Show Gist options
  • Save norm/eb73bdd32632c91ab3f649950f34812f to your computer and use it in GitHub Desktop.
Save norm/eb73bdd32632c91ab3f649950f34812f to your computer and use it in GitHub Desktop.
from textwrap import dedent
BILLS = dedent("""
50 padding
32.00 O2
100.00 charities
15.00 medicines, supplements
5 Monzo Plus
# internet things
35.40 Zen internet
5.00 GitHub
60.00 AWS
2.50 Fastmail $36/y (£30)
6.99 iCloud 2tb
# devices
3.49 iPad Mini AppleCare+
0.25 GIFwrapped £2.99/y 13 Aug
# entertainment
10.99 Netflix
4.16 Apple TV+ £49.99/y 8 Jul
6.70 Disney+ subscription £80/y
# delivery subscriptions
14.00 Whisky-Me £168/y
""")
month_total = 0
for line in BILLS.split('\n'):
if line and not line.startswith('#'):
amount, description = line.split(None, 1)
month_total += float(amount)
print('£%4.2f total' % month_total)
(sinister)% python ~/Notes/monthly\ bills.txt
£351.48 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment