Skip to content

Instantly share code, notes, and snippets.

@benekastah
Last active August 29, 2015 14:23
Show Gist options
  • Save benekastah/93814e116883a23a3cbf to your computer and use it in GitHub Desktop.
Save benekastah/93814e116883a23a3cbf to your computer and use it in GitHub Desktop.
Meal planner
import random
carbs = ['noodles', 'bread', 'toast']
protein = ['egg', 'beef', 'chicken']
fruit = ['banana', 'apple', 'orange']
def meal():
# This is a list comprehension: https://docs.python.org/2/tutorial/datastructures.html#list-comprehensions
return [random.choice(l) for l in [carbs, protein, fruit]]
print 'Breakfast: {}'.format(meal())
print 'Lunch: {}'.format(meal())
print 'Dinner: {}'.format(meal())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment