how to dynamically infer an element by array index? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to dynamically infer an element by array index?

2 3 index=int(input("Input number from 0 to 2")) list_movie={"Swim","Fight","Fly"} print(list_movie[index]) #How true write the line?

8th Feb 2020, 12:22 PM
Сотник Валентин
Сотник Валентин - avatar
2 Answers
+ 2
index is not possible for set list_movie = [.....] not{... }
8th Feb 2020, 12:32 PM
Oma Falk
Oma Falk - avatar
+ 2
Jan Markus bist du wieder fit?
8th Feb 2020, 12:34 PM
Oma Falk
Oma Falk - avatar