|Previous Lesson||Current Lesson||Next Lesson|
l = (23, "dog", 5)
Take the Python object elements, separate them with commas, and surround with parentheses. Python will do the rest of the (hard) work for you.
Building on from the previous solution, we have:
t = (23, "dog", 5) print(t)
This will output:
Remember, to access the
nth element of a
tuple, we must use
n - 1 as the
index. In this case, we want the first element, so we must use the index
3 - 1 = 2.