Created
October 20, 2021 16:16
-
-
Save RobertTalbert/a483a536ae2d2e9e653e03fe54e9aba5 to your computer and use it in GitHub Desktop.
This file contains 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
# To find the natural number solutions to x + y + z = 8 | |
[(x,y,z) for x in range(9) for y in range(9) for z in range(9) if x+y+z == 8] | |
# To generate the ways to pick 6 donuts from an unlimited supply of glazed, chocolate, and jelly-filled | |
[(g,c,j) for g in range(7) for c in range(7) for j in range(7) if g+c+j == 6] | |
# Put `len( )` around these lists to find the number of items in the list. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment