Computer Science
Find the output generated by following code fragments :
t2 = (4, 5, 6)
t3 = (6, 7)
t4 = t3 + t2
t5 = t2 + t3
print(t4)
print(t5)
Python Tuples
1 Like
Answer
Output
(6, 7, 4, 5, 6)
(4, 5, 6, 6, 7)
Explanation
Concatenate operator concatenates the tuples in the same order in which they occur to form new tuple. t2
and t3
are concatenated using +
operator to form tuples t4
and t5
.
Answered By
1 Like
Related Questions
Find the output generated by following code fragments :
T5 = (17,) type(T5)
Find the output generated by following code fragments :
tuple = ( 'a' , 'b', 'c' , 'd' , 'e') tuple = ( 'A', ) + tuple[1: ] print(tuple)
Find the output generated by following code fragments :
t3 = (6, 7) t4 = t3 * 3 t5 = t3 * (3) print(t4) print(t5)
Find the output generated by following code fragments :
t1 = (3,4) t2 = ('3' , '4') print(t1 + t2 )