class Plant: def __init__(self,name,family,water_level,ph,sunlight,fertilizer): self.name=name self.family=family self.water_level=water_level self.ph=ph self.sunlight=sunlight self.fertilizer=fertilizer def watering(self): if self.water_level=="Light": print("WATERING....DONE") elif self.water_level=="Medium": print("WATERING...WATERING...DONE") elif self.water_level=="Heavy": print("WATERING...WATERING...WATERING...DONE") else: print("INVALID INPUT") def plant_info(self): print(self.name, " is a ",self.family," and has ",self.water_level," watering requirements, ", self.ph," PH Level"," and needs ",self.sunlight,"sunlight and a",self.fertilizer,"fertilizer") Pepper=Plant('Pepper','Solanaceae', 'Medium','6.0','Bright','13-13-13') Tomatoe=Plant('Tomatoe','Solanaceae', 'Medium','6.0','Bright','13-13-13') Broccoli=Plant('Broccoli','Brassicaceae', 'Light','5.5', 'Partial Sun','13-10-10') Plants=[] Plants.append(Pepper) Plants.append(Tomatoe) Plants.append(Broccoli) Plant_selection=input("PLEASE INPUT PLANT") for Plant_selection in Plants: Plant_selection.plant_info()
buran write Feb-14-2024, 02:17 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.