i am start to learn how to write python code
There is an option to write code ones onthis situation? i want to crate class and 2 class how extend from her and i want to check if i can loop on only ones my example:
class animal: def printDetail(self): print(self.name) class bird(animal): def printDetail(self): super(bird, self).printName() print(self.wingsSize) class fish(animal): def printDetail(self): super(fish, self).printName() print(self.weight) fishList = [] birdList = [] animalList = [] def main(): for a in (animalList,fishList,birdList): a.printDetail() main() when i try to do it i got an error that AttributeError: 'list' object has no attribute 'printDetail' like this is an unknow function. i understand that it try to take the attribute of the list class but there is any option that i can do it more esear then:
for a in animalList: a.printDetail() for a in fishList: a.printDetail() for a in birdList: a.printDetail() that is work fine but to long?
(animalList,fishList,birdList)and the second to loop over the list that you get from that.