Q: Python list selection I'm an absolute amateur when it comes to any coding but I have been attempting to create a top trumps type program using Python. In the below code I have created player cards that are added to a list using a class. I am now attempting to randomly split the list (fullCardList) into two separate lists but having a lot of issues.
Once the list has been split, I am aiming to compare a stat from each player but cannot seem to figure how to show the card's name/caps/goals. I hope this makes sense. Can anyone give me any advice?
class Player:
def __init__(self, name, caps, goals, trophies):
    self.name = name
    self.caps = caps
    self.goals = goals
    self.trophies = trophies


CardListOne = Player("Lionel Messi",102, 46, 26)
CardListTwo = Player("Ronaldo", 124, 55, 17)
CardListThree = Player("Mats Hummels", 39, 4, 8)
CardListFour = Player("Angel Di Maria", 65, 15, 10)
CardListFive = Player("Jason", 101,44,12)
CardsListSix = Player("Peter", 45,10,1)

fullCardList = [CardListOne.name, CardListOne.caps,CardListOne.goals,CardListOne.trophies],[CardListTwo.name,CardListTwo.caps,CardListTwo.goals,CardListTwo.trophies],[CardListThree.name, CardListThree.caps, CardListThree.goals, CardListThree.trophies], [CardListFour.name,CardListFour.caps,CardListFour.goals,CardListFour.trophies], [CardListFive.name,CardListFive.caps,CardListFive.goals,CardListFive.trophies]

global playersRandomSelection, computersRandomSelection
playersRandomSelection = []
playersRandomSelection = random.sample(fullCardList,3)

computersRandomSelection = []
computersRandomSelection = random.sample(fullCardList,3)


print("Players name selection: " + str(playersRandomSelection))
print("Computers random selection: " + str(computersRandomSelection))


A: 
Hhow to show the card's name/caps/goals/(trophies):

You can use the method, vars():
lst = [CardListOne,CardListTwo,CardListThree,CardListFour,CardListFive,CardsListSix]
for n in lst:
    a = vars(n)
    print('\n'.join(f"{k}: {v}" for k,v in a.items()))
    print()

Output:
name: Lionel Messi
caps: 102
goals: 46
trophies: 26

name: Ronaldo
caps: 124
goals: 55
trophies: 17

name: Mats Hummels
caps: 39
goals: 4
trophies: 8

name: Angel Di Maria
caps: 65
goals: 15
trophies: 10

name: Jason
caps: 101
goals: 44
trophies: 12

name: Peter
caps: 45
goals: 10
trophies: 1

