Computer Science
What does a + b amount to if a and b are tuples?
Python Tuples
1 Like
Answer
Given a and b are tuples, so in this case the + operator will work as concatenation operator and join both the tuples.
For example:
a = (1, 2, 3)
b = (4, 5, 6)
c = a + b
Here, c is a tuple with elements (1, 2, 3, 4, 5, 6)
Answered By
2 Likes
Related Questions
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?
What does a * b amount to if a and b are tuples?
What does a + b amount to if a is a tuple and b is 5?