pypy-sandbox-4-pycode / demo / foodbill.py

"""
Of historical interest: we computed the food bill of our first Gothenburg
sprint with PyPy :-)
"""

slips=[(1, 'Kals MatMarkn', 6150, 'Chutney for Curry', 'dinner Saturday'),
       (2, 'Kals MatMarkn', 32000, 'Spaghetti, Beer', 'dinner Monday'),
       (2, 'Kals MatMarkn', -810, 'Deposit on Beer Bottles', 'various'),
       (3, 'Fram', 7700, 'Rice and Curry Spice', 'dinner Saturday'),
       (4, 'Kals MatMarkn', 25000, 'Alcohol-Free Beer, sundries', 'various'),
       (4, 'Kals MatMarkn', -1570, "Michael's toothpaste", 'none'),
       (4, 'Kals MatMarkn', -1690, "Laura's toothpaste", 'none'),
       (4, 'Kals MatMarkn', -720, 'Deposit on Beer Bottles', 'various'),
       (4, 'Kals MatMarkn', -60, 'Deposit on another Beer Bottle', 'various'),
       (5, 'Kals MatMarkn', 26750, 'lunch bread meat cheese', 'lunch Monday'),
       (6, 'Kals MatMarkn', 15950, 'various', 'dinner Tuesday and Thursday'),
       (7, 'Kals MatMarkn', 3650, 'Drottningsylt, etc.', 'dinner Thursday'),
       (8, 'Kals MatMarkn', 26150, 'Chicken and Mushroom Sauce', 'dinner Wed'),
       (8, 'Kals MatMarkn', -2490, 'Jacob and Laura -- juice', 'dinner Wed'),
       (8, 'Kals MatMarkn', -2990, "Chicken we didn't cook", 'dinner Wednesday'),
       (9, 'Kals MatMarkn', 1380, 'fruit for Curry', 'dinner Saturday'),
       (9, 'Kals MatMarkn', 1380, 'fruit for Curry', 'dinner Saturday'),
       (10, 'Kals MatMarkn', 26900, 'Jansons Frestelse', 'dinner Sunday'),
       (10, 'Kals MatMarkn', -540, 'Deposit on Beer Bottles', 'dinner Sunday'),
       (11, 'Kals MatMarkn', 22650, 'lunch bread meat cheese', 'lunch Thursday'),
       (11, 'Kals MatMarkn', -2190, 'Jacob and Laura -- juice', 'lunch Thursday'),
       (11, 'Kals MatMarkn', -2790, 'Jacob and Laura -- cereal', 'lunch Thurs'),
       (11, 'Kals MatMarkn', -760, 'Jacob and Laura -- milk', 'lunch Thursday'),
       (12, 'Kals MatMarkn', 18850, 'lunch bread meat cheese', 'lunch Friday'),
       (13, 'Kals MatMarkn', 18850, 'lunch bread meat cheese', 'guestimate Sun'),
       (14, 'Kals MatMarkn', 18850, 'lunch bread meat cheese', 'guestimate Tues'),
       (15, 'Kals MatMarkn', 20000, 'lunch bread meat cheese', 'guestimate Wed'),
       (16, 'Kals MatMarkn', 42050, 'grillfest', 'dinner Friday'),
       (16, 'Kals MatMarkn', -1350, 'Deposit on Beer Bottles', 'dinner Friday'),
       (17, 'System Bolaget', 15500, 'Cederlunds Caloric', 'dinner Thursday'),
       (17, 'System Bolaget', 22400, '4 x Farnese Sangiovese 56SEK', 'various'),
       (17, 'System Bolaget', 22400, '4 x Farnese Sangiovese 56SEK', 'various'),
       (17, 'System Bolaget', 13800, '2 x Jacobs Creek 69SEK', 'various'),
       (18, 'J and Ls winecabinet', 10800, '2 x Parrotes 54SEK', 'various'),
       (18, 'J and Ls winecabinet', 14700, '3 x Saint Paulin 49SEK', 'various'),
       (18, 'J and Ls winecabinet', 10400, '2 x Farnese Sangioves 52SEK',
        'cheaper when we bought it'),
       (18, 'J and Ls winecabinet', 17800, '2 x Le Poiane 89SEK', 'various'),
       (18, 'J and Ls winecabinet', 9800, '2 x Something Else 49SEK', 'various'),
       (19, 'Konsum', 26000, 'Saturday Bread and Fruit', 'Slip MISSING'),
       (20, 'Konsum', 15245, 'Mooseburgers', 'found slip'),
       (21, 'Kals MatMarkn', 20650, 'Grilling', 'Friday dinner'),
       (22, 'J and Ls freezer', 21000, 'Meat for Curry, grilling', ''),
       (22, 'J and Ls cupboard', 3000, 'Rice', ''),
       (22, 'J and Ls cupboard', 4000, 'Charcoal', ''),
       (23, 'Fram', 2975, 'Potatoes', '3.5 kg @ 8.50SEK'),
       (23, 'Fram', 1421, 'Peas', 'Thursday dinner'),
       (24, 'Kals MatMarkn', 20650, 'Grilling', 'Friday dinner'),
       (24, 'Kals MatMarkn', -2990, 'TP', 'None'),
       (24, 'Kals MatMarkn', -2320, 'T-Gul', 'None')
       ]
 
print [t[2] for t in slips]
print (reduce(lambda x, y: x+y, [t[2] for t in slips], 0))/900
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.