def main(): if any(plant.plant_type == "Grass" for plant in plants_dict.values()): print("This dict contains Grass") else: print("NO GRASS HERE ")
from data import plants_dict, plants_list, people # people = [] if bool(people) and all([person[1] for person in people]): print("sending email") else: print("user must edit the recipients") if any([plant.plant_type == "Grass" for plant in plants_list]): print("This pack contains grass") else: print("No grass in this pack") if any(plants_dict[key].plant_type == "Grass" for key in plants_dict): print("This pack contains grass") else: print("No grass in this pack") if any(plant.plant_type == "Grass" for plant in plants_dict.values()): print("This pack contains grass") else: print("No grass in this pack") if any(plants_dict[key].plant_type == "Cactus" for key in plants_dict): print("This pack contains grass") else: print("No grass in this pack")
from data import people, plants_list, plants_dict # make sure people are not empty too if bool(people) and all(person[1] for person in people): print("Sending email") else: print("User must edit the list of recipients") if any([plant.plant_type == "Grass" for plant in plants_list]): print("This pack contains grass") else: print("No grasses in this pack") # mini challenge if bool(plants_dict.values()) and any([plant.plant_type == "Grass" for plant in plants_dict.values()]): print("Grass in dict") else: print("No grass in dict") # variant if bool(plants_dict.values()) and any([plant.plant_type == "Grass" for plant in plants_dict.values()]): print("Grass in dict") else: print("No grass in dict")
from data import people, plants_dict, plants_list if bool(people) and all([person[1] for person in people]): print("Sending email") else: print("User must edit the list of recipient") if any([plant.plant_type == "Grass" for plant in plants_list]): print("This pack contains grass") else: print("No grasses in this pack") if any([plant.plant_type == "Cactus" for plant in plants_dict.values()]): print("This pack contains grasses") else: print("No grasses in this pack")
from data import people, basic_plants_list, plants_list, plants_dict # check to see if any plants in plants_dict to see if ther are any grasses in there #run code again search for catus to test that it still works when there arent any if bool(plants_dict) and any( [plant.plant_type == "Grass" for plant in plants_dict.values()]): print("found a grass plant type") else: print("didnt find a grass type")