Computer Science
Find the output generated by following code fragments :
T4 = (17)
type(T4)
Python Tuples
2 Likes
Answer
Output
<class 'int'>
Explanation
Since no comma is added after the element, so even though it is enclosed in parenthesis still it will be treated as an integer, hence T4 stores an integer not a tuple.
Answered By
2 Likes
Related Questions
Find the output generated by following code fragments :
t2 = ('a') type(t2)Find the output generated by following code fragments :
t3 = ('a',) type(t3)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)