class Mushroom:
def __init__(self,name,color_cap,color_gills,scales,poisenous):
self.name = name
self.color_cap = color_cap
self.color_gills = color_gills
self.scales = scales
self.poisenous = poisenous
def is_poisonous(self):
if self.poisenous == "Poisonous":
print("This Mushroom is poisonous")
else:
print("This Mushroom can be eaten")
amanita_muscaria=Mushroom("Chervena muhomorka","Red","White",True,"Poisonous")
print(amanita_muscaria.eate)
My question is exacly how i can get the program to print if the mushroom is poisonous or it can be eaten.Maybe a for loop will be better.I want my final product to be a database with mushrooms where the user inputs a name,cap color,gills color and scales to get printed all the mushrooms in the database/txt.file that have the same attributes and to tell him if the mushroom is poisenous or not
Aucun commentaire:
Enregistrer un commentaire