Last active
February 5, 2026 13:54
-
-
Save epignatelli/f6d9b634afed515515dfe36ec2e632cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime as dt | |
| def f(x): | |
| """Sums purchase amounts for UK entries. | |
| Args: | |
| purchases: List of dicts with keys "country" and "amount". | |
| Returns: | |
| Total amount for purchases where country == "UK". | |
| """ | |
| t=0 | |
| for i in x: | |
| if i[ "c" ]=="UK": | |
| try: t+=float(i [ "a" ]) | |
| except: pass | |
| print("TOTAL",t,"@",dt.datetime.now());return t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment