How do I index a tuple inside of a list? Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I index a tuple inside of a list? Python

Ok guys I don't know why I am having so much trouble with this but intermediate python practice 4.2. It gives a list with tuples inside such as: List=[('bob',42), ('Lisa',35)] It wants me to take input: bob And output: bob is 42 Is there a way to index bob and add 1 to output the age? Or is it expecting me to use if else to link the input to the age? I have tried again and again to figure it out on my own so any help is welcome.

23rd May 2021, 4:02 AM
SeveredData
SeveredData - avatar
2 Answers
+ 2
Using unpacking tuple.. SeveredData see this code 👇 👇 https://code.sololearn.com/cb5eQV7uwb3W/?ref=app
23rd May 2021, 4:09 AM
Sâñtôsh
Sâñtôsh - avatar
0
Thank you guys so much for the help!
23rd May 2021, 4:39 AM
SeveredData
SeveredData - avatar