Nowy kurs! Każdy programista powinien nauczyć się Generative AI!
Wypróbuj darmową lekcję0
A game machine has 5 games installed on it, represented in this list: games = ['Soccer', 'Tic Tac Toe', 'Snake', 'Puzzle', 'Ra
A game machine has 5 games installed on it, represented in this list: games = ['Soccer', 'Tic Tac Toe', 'Snake', 'Puzzle', 'Rally'] PY The code that you're about to see takes a number as input, which indicates the choice index. Task Complete the program to output the game from the list that corresponds to that index. img-component
5 odpowiedzi
+ 4
Can you share your attempt?
+ 1
# Juegos instalados
games = [
'Soccer', 'Tic Tac Toe', 'Snake',
'Puzzle', 'Rally']
# Tomar la elección del jugador como un número de entrada
choice = int(input())
# Mostrar el juego correspondiente
if choice == 0 or choice == 2 or choice == 4 :
print(games[choice])
0
for example:
create a choice variable which needs an input as integer, after that if the number is between the game's indexes, then just print it out
0
I don't know why you want to compare the input with anything, you just have to output the corresponding game
0
I like to play various games. But lately I have been very attracted to gambling. I found an interesting review https://c24vip.com/games/baccarat/ Where I managed to choose the best ones for myself. Now I often play with friends in the evenings.