Computer Science
Consider the following code and find out the error:
tup1=('A', 'school', 10.5, 70)
print max(tup1)
Python Tuples
3 Likes
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.
Answered By
1 Like
Related Questions
Consider the following code and find out the error:
tup1 = ("Riya", ) * '4'Consider the following code and find out the error:
t1 = (10, 20, 30, 40) X, Y, Z = t1Consider the following code and find out the error:
t = (10, 20, 30, 40) t[1] = 'o'Consider the following code and find out the error:
T1 = ('A') T2 = ('B', 'C', 3) T3 = T1 + T2