I am trying to print ages of all instances of my player class. In my mind, it was something like that "Bob is an instance of "player" class, Bob has a name which is obviously Bob and an age". I also tried to make a variable with a name provided by the user.
names=[]
class player:
    def __init__(self,name,age):
        self.name=name
        self.age=age
playerNumber=int(input("How many players? "))
while playerNumber:
    name=input("enter your name ")
    age=input("enter your age ")
    vars()['name']=player(name,age)
    names.append(vars()['name'].name)
    playerNumber-=1
for x in names:
    print(vars()["x"].age)
