KnowledgeBoat Logo

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