Foundations of Python

You are currently auditing this course.
121 / 134

Working with Tuples

We can access elements of the tuple using square brackets but we can't reassign the value because tuples are immutable. We can also slice the tuples to get multiple elements using the indices as the range.

t = (1,3,5,2,54,34,2,34,5)
l = len(t)
print(t[l-2])

Enter the result

t2 = t[2:5]

What will be the sum of elements present in t2?

t3 = t[1:3] + t2[:]

What will be the sum of elements present in t3?

Get Hint

Answer is not availble for this assesment

Loading comments...