Last active
January 15, 2016 10:43
-
-
Save gphilipp/87d7278ed72fde3adc1a 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
| # i'd like to have this printed out, using nested zip data structures: | |
| # john eats roasted pizza | |
| # mary eats raw vegetables | |
| # john eats tender chicken | |
| # But there's an error at line 'for f, c in fc:' saying: ValueError: too many values to unpack | |
| people = ["john", "mary", "doug"] | |
| food = ["pizza", "vegetables", "chicken"] | |
| cooked = ["roasted", "raw", "tender"] | |
| food_cooked = zip(food, cooked) | |
| people_food_cooked = zip(people, food_cooked) | |
| for p, fc in people_food_cooked: | |
| for f, c in fc: | |
| print(p + "eats " + c +" " + f) | |
| # Note : the end goal is not to print, I know I can do | |
| for p,f,c in zip(people, food, cooked): | |
| print (p + " eats " + c + " " + f) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment