Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Human sorter based on their condition >:D
- # below this line in the multi line comment is the code I imported
- """
- class Person:
- def __init__(self, name, age, health, gender,):
- self.name = name
- self.age = age
- self.health = health
- self.gender = gender
- """
- from Classes import Person
- Human1 = Person("Bobby", 12, "clean", "Male")
- Human2 = Person("Kermit", 21, "smoker", "Male")
- Human3 = Person("Vanessa", 31, "drug addict", "Female")
- Human4 = Person("Bobby", 6, "drug addict", "Male")
- Human5 = Person("Big PP Boi", 14, "smoker", "Toaster")
- lists =[Human1, Human2, Human3, Human4, Human5]
- clean_list = []
- smoke_list = []
- drug_list = []
- for output in lists:
- if output.health == "clean":
- clean_list.append(output.name)
- elif output.health == "smoker":
- smoke_list.append(output.name)
- else:
- drug_list.append(output.name)
- print("List of clean ppl: " + str(clean_list))
- print("List of smokers: " + str(smoke_list))
- print("List of drug addicts: " + str(drug_list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement