Really simple question here. After ben is created, is there anyway I can call ben[0] to call name and ben[1] to call age?
i'm wondering if there is a way to access these attributes as a list.
class People():
def __init__(self, name, age):
ben=People("ben", "10")
ben.nameandben.age. If you insist on using indexing, you should implement__getitem__on the class.