[Python] How do I take the index numbers as input and output the game names? [closed]

Discussão em 'Python' iniciado por Stack, Julho 5, 2025.

  1. Stack

    Stack Membro Participativo

    The following program must output the corresponding index number associated with the items in the list titled "games"

    #installed games
    games = [
    'Soccer', 'Tic Tac Toe', 'Snake',
    'Puzzle', 'Rally']

    #taking player's choice as a number input
    choice = int(input())

    #output the corresponding game
    if choice == games[choice]:
    print(games[0, 1, 2, 3, 4])

    Continue reading...

Compartilhe esta Página