Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Review Python Lists (Exercises)

Avatar image for Ivan Mladenovity

Ivan Mladenovity on Feb. 3, 2024

Hello Martin! Are we using enumerate here in for loop for Row 1 and Row 2?

Avatar image for Syed

Syed on Feb. 17, 2024

Hello Martin,

I have same question as Ivan**

Avatar image for Martin Breuss

Martin Breuss RP Team on Feb. 19, 2024

Hi @Ivan Mladenovity and @Syed, you can use enumerate(), but you don’t have to.

You can check out some possible solutions in the related lesson on Tuple Sums in the Tuples and Lists Exercises Course.

Avatar image for ivan.dimitri

ivan.dimitri on Sept. 16, 2024

data = [(1, 2), (3, 4)]

for tup in data:

    sum(tup)

    print(f"Row {data.index(tup) + 1} sum: {sum(tup)}")
Avatar image for Nathaniel J Hall

Nathaniel J Hall on March 22, 2025

Thanks Ivan.

Avatar image for Victor Lee

Victor Lee on June 16, 2025

@ivan.dimitri Thank you for the demonstration! I believe line 3 of your code sum(tup) is not needed, since you can use that directly inside the f-string. Or you can assign it as a local variable, and call the variable in the f-string.

Become a Member to join the conversation.