Computer Science
Find the output generated by following code fragments :
T5 = (17,)
type(T5)
Python Tuples
1 Like
Answer
Output
<class 'tuple'>
Explanation
Since 17
is enclosed in parenthesis and a comma is added after it, so T5 becomes a single element tuple instead of an integer.
Answered By
2 Likes
Related Questions
Find the output generated by following code fragments :
t3 = ('a',) type(t3)
Find the output generated by following code fragments :
T4 = (17) type(T4)
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 :
t2 = (4, 5, 6) t3 = (6, 7) t4 = t3 + t2 t5 = t2 + t3 print(t4) print(t5)