In my program I define a survivor
class below and instance it.
class survivor(object) :
def __init__(self, fname, sname, age, currhealth, maxhealth, currwill, maxwill,currspeed,maxspeed, ability):
self.fname = fname
self.sname = sname
self.age = age
self.health = currhealth
self.maxhealth = maxhealth
self.will = currwill
self.maxwill = maxwill
self.speed = currspeed
self.maxspeed = maxspeed
self.ability = ability
Samuel = survivor("Samuel","Jordie",17,6,6,2,2,4,4,"Strength")
Marie = survivor("Marie","Wems",16,4,4,5,5,4,4,"Heal")
Cumbo = survivor("Cumbo","Chan",17,3,3,4,4,3,3,"Consume")
Sinead = survivor("Sinead","Mess",17,5,5,5,5,6,6,"Tools")
Maria = survivor("Maria","Wiks",16,4,4,5,5,2,4,"Eat")
The user chooses 4 survivors and a list of the names of these survivors is created for example
chosen_survivors = ["Samuel","Maria","Cumbo","Sinead"]
I then want to present some attributes of the chosen survivor to the user, irrespective of which survivor they choose.
E.g
print(chosen_survivors[0].health)
How do I achieve this?