353,900 views
42 votes
42 votes
Can someone help me with this lengthy code thanks

Can someone help me with this lengthy code thanks-example-1
User Siva Kumar Reddy G
by
3.2k points

1 Answer

13 votes
13 votes

Answer:

Declare an empty list of tuples (see the line below the function declaration header in my code example), which will have values appended to it as a result of the iterations of your loop.

Use a loop that runs for as many indecies as one of your tuples has (this works because we can assume each iterable is the same length, so it doesn't matter which one we choose.) Your use of the len method is good, but the loop structure needs tinkering.

Append to the previously declared list of tuples for each iteration, so that you may return a list of tuples that has the new values you need passed in. (Also, we want to make the return statement run after all the iterations are ran.)

User Raj Yadav
by
2.6k points