Computer Science
Find the output generated by following code fragments :
t3 = ('a',)
type(t3)
Python Tuples
3 Likes
Answer
Output
<class 'tuple'>
Explanation
Since 'a'
is enclosed in parenthesis and a comma is added after it, so t3 becomes a single element tuple instead of a string.
Answered By
1 Like
Related Questions
a, b, c, d, e = (p, q, r, s, t) = t1
What will be the values and types of variables a, b, c, d, e, p, q, r, s, t if t1 contains (1, 2.0, 3, 4.0, 5) ?
Find the output generated by following code fragments :
t2 = ('a') type(t2)
Find the output generated by following code fragments :
T4 = (17) type(T4)
Find the output generated by following code fragments :
T5 = (17,) type(T5)