Computer Science

Predict the output.

tuple1 = ('Python') * 3  
print(type(tuple1))  

Python Tuples

2 Likes

Answer

Output
<class 'str'>   
Explanation

This is because tuple1 is not a tuple but a string. To make tuple1 a tuple it should be initialized as following:
tuple1 = ('Python',) * 3
i.e. a comma should be added after the element.

Answered By

1 Like


Related Questions