CBSE Class 11 Computer Science Question 70 of 114

Tuples — Question 7

Back to all questions
7
Question

Question 1(g)

Find the output generated by following code fragments :

t2 = ('a') 
type(t2)
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.