[Python] Need to Create a list of tuples containing each player's name along with their...

Discussão em 'Python' iniciado por Stack, Março 26, 2025.

  1. Stack

    Stack Membro Participativo

    Hi I have this dictionary :

    players = {
    'L. Messi': {
    'age': 31,
    'nationality': 'Argentina',
    'teams': ['Barcelona']
    },
    'Cristiano Ronaldo': {
    'age': 33,
    'nationality': 'Portugal',
    'teams': ['Juventus', 'Real Madrid', 'Manchester United']
    },
    'Neymar Jr': {
    'age': 26,
    'nationality': 'Brazil',
    'teams': ['Santos', 'Barcelona', 'Paris Saint-German']
    },
    'De Gea': {
    'age': 27,
    'nationality': 'Spain',
    'teams': ['Atletico Madrid', 'Manchester United']
    },
    'K. De Bruyne': {
    'age': 27,
    'nationality': 'Belgium',
    'teams': ['Chelsea', 'Manchester City']
    }
    }


    how can I create a list of tuples containing each players names with their nationality? should I use zip()

    Continue reading...

Compartilhe esta Página