i've been stuck on this python level | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

i've been stuck on this python level

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?

21st Jan 2024, 11:42 AM
Kaleab Alemu
Kaleab Alemu - avatar
4 Answers
+ 8
Kaleab Alemu , please do a try by yourself first. HINT: > to get the required output, we can use the *input number* (int) as an index [...] of the list *games*.
21st Jan 2024, 11:55 AM
Lothar
Lothar - avatar
+ 7
You want to output the game of the user's choice so you need to change your print statement. print(games[0]) should be print(games[choice]) Otherwise it's always going to output Soccer.
21st Jan 2024, 1:36 PM
Keith
Keith - avatar
+ 2
tag the programming language, not your name
21st Jan 2024, 12:11 PM
Lisa
Lisa - avatar
0
while am choose choice=int(input()) 0 print(games[0]) ???
21st Jan 2024, 1:00 PM
Kaleab Alemu
Kaleab Alemu - avatar