Exercises on Python Tuples

The following exercises cover Tuples in Python.

Exercise 1

Complete the syntax to create a tuple of a string, and two numbers, mytuple.

mytuple = 'apple', 10, 40

Exercise 2

Print second element from the tuple mytuple.

mytuple = ('apple', 10, 40)
print(mytuple[])

Exercise 3

Print last element in the tuple mytuple using negative index.

mytuple = ('apple', 10, 40)
print(mytuple[])

Exercise 4

Iterate over the elements of the tuple mytuple using For loop.

mytuple = ('apple', 10, 40)
for item  :
    print(item)

Code copied to clipboard successfully 👍