Computer Science
How do you create the following tuples?
(a) (4, 5, 6)
(b) (-2, 1, 3)
(c) (-9, -8, -7, -6, -5)
(d) (-9, -10, -11, -12)
(e) (0, 1, 2)
Python Tuples
4 Likes
Answer
(a) tup = (4, 5, 6)
(b) tup = (-2, 1, 3)
(c) tup = (-9, -8, -7, -6, -5)
(d) tup = (-9, -10, -11, -12)
(e) tup = (0, 1, 2)
Answered By
3 Likes
Related Questions
What values can we have in a tuple? Do they all have to be the same type*?
How are individual elements of tuples accessed?
If a = (5, 4, 3, 2, 1, 0) evaluate the following expressions:
(a) a[0]
(b) a[1]
(c) a[a[0]]
(d) a[a[-1]]
(e) a[a[a[a[2]+1]]]
Can you change an element of a sequence? What if a sequence is a dictionary? What if a sequence is a tuple?