t=('ali','rahul','ram')
In the above code, when I run the max function,
print(max(t))
this is the output I get : ram
Why do I get Ram and not Ali?
t=('ali','rahul','ram')
In the above code, when I run the max function,
print(max(t))
this is the output I get : ram
Why do I get Ram and not Ali?
max()
will return the largest element, either by comparing numbers or comparing strings lexicographically (the same way words are ordered in a dictonary -- the book one, not the python dict()
):
>>> max((1,2,3))
3
>>> max(('b','a','c'))
'c'
>>>