Created
May 8, 2020 08:05
-
-
Save raeq/e1314c0f7fe35f68e7b2328b9aecd697 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
fruits_dict: dict = dict() | |
citrusfruit: set = {"oranges", "lemons", "limes", "satsumas", "nectarines"} | |
treefruit: set = {"apples", "pears", "cherries", "plums", "peaches", "plums", | |
"cherries", "oranges", "lemons", "limes"} | |
stonefruit: set = {"cherries", "plums", "peaches", "nectarines"} | |
for fruit in citrusfruit.union(stonefruit).union(treefruit): | |
fruits_dict.setdefault(fruit, []) | |
for key, value in fruits_dict.items(): | |
if key in citrusfruit: | |
value.append("citrusfruit") | |
if key in treefruit: | |
value.append("treefruit") | |
if key in stonefruit: | |
value.append("stonefruit") | |
print(fruits_dict) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment