CBSE Class 11 Computer Science Question 63 of 88

Tuples and Dictionary — Question 28

Back to all questions
28
Question

Question 14(e)

Consider the following code and find out the error:

tup1=('A', 'school', 10.5, 70)
print max(tup1) 
Answer

The max() function should be used within parentheses in the print statement. Additionally, for the max() function to work, all elements in the tuple must be of the same type; otherwise, Python cannot compare them, leading to an Error.