Computer Science
Find the output generated by following code fragments :
t2 = ('a')
type(t2)
Python Tuples
2 Likes
Answer
Output
<class 'str'>
Explanation
The type() function is used to get the type of an object. Here, 'a' is enclosed in parenthesis but comma is not added after it, hence it is not a tuple and belong to string class.
Answered By
3 Likes
Related Questions
Find the output generated by following code fragments :
a, b, c, d, e = (p, q, r, s, t) = t1
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 :
t3 = ('a',) type(t3)
Find the output generated by following code fragments :
T4 = (17) type(T4)