<reponame>AgentKD6-37/2022-01-04-Python<filename>Day 3/Lab-22-Challenge.py<gh_stars>1-10
#!/usr/bin/env python3

def main():
    """Solution by myself. Drill down into each dictionary, check if the item is a farm name, if so: print it! if not,
    we save the value of the item as a new var, then loop through that list"""


    farms = [{"name": "NE Farm", "agriculture": ["sheep", "cows", "pigs", "chickens", "llamas", "cats"]},
             {"name": "W Farm", "agriculture": ["pigs", "chickens", "llamas"]},
             {"name": "SE Farm", "agriculture": ["chickens", "carrots", "celery"]}]
    for farm in farms:
        for item in farm:
            if item == "name":
                print("The farm name is: " + farm[item])
            else:
                aglist = farm[item]
                print("The farms products are: ")
                for i in aglist:
                    print(i)
        print("----------------")


main()
3/Lab-22-Challenge.py<gh_stars>1-10
#!/usr/bin/env python3

def main():
    """Solution by myself. Drill down into each dictionary, check if the item is a farm name, if so: print it! if not,
    we save the value of the item as a new var, then loop through that list"""


    farms = [{"name": "NE Farm", "agriculture": ["sheep", "cows", "pigs", "chickens", "llamas", "cats"]},
             {"name": "W Farm", "agriculture": ["pigs", "chickens", "llamas"]},
             {"name": "SE Farm", "agriculture": ["chickens", "carrots", "celery"]}]
    for farm in farms:
        for item in farm:
            if item == "name":
                print("The farm name is: " + farm[item])
            else:
                aglist = farm[item]
                print("The farms products are: ")
                for i in aglist:
                    print(i)
        print("----------------")


main()
#!/usr/bin/env python3 Solution by myself. Drill down into each dictionary, check if the item is a farm name, if so: print it! if not,     we save the value of the item as a new var, then loop through that list