+ 4
i've been stuck on this python level
its a python level where you have to make a video game console, and you let the user choose between some games, here is the code: #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 how do i do this?
5 ответов
+ 10
**🇦🇪|🇦🇪**
> it is not seen as very helpful when we are going to post a solution that solves the exercise.
> it is more helpful to give hints and tips, so that the op has a chance to find a solution by himself.
+ 5
Abood Maswadeh review how to use indexing on a list. Use the numeric choice as an index to select the game name.
+ 3
Hint: Remember list indexing. :)
+ 2
if the user input 2 the output should be Snake right?
how you code this condition
maybe :
if choice==2:
print(games[2])
so what you will change 🧐? maybe games[choice] think about it
0
#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
print(games[choice])