+ 1

How can i get the value from the list that is in a dictionary?

dic={"a":[1,2]} I want to get, for example, 2, how should I do this? Is it like print (dic ["a"][0][1])#?

2nd Jul 2019, 2:05 PM
Valeria Vasylieva
2 Answers
+ 1
Some explanations about dictionaries. https://code.sololearn.com/ckNondB1JT7f/?ref=app
2nd Jul 2019, 2:37 PM
Théophile
Théophile - avatar
+ 1
Théophile Thanks, I tried this one dict={"w":[1,2]} for value in dict.values(): print(value [1]) Unfortunately, it works not in all cases. I'll continue to experiment
2nd Jul 2019, 3:11 PM
Valeria Vasylieva