I have a list:
list1 = [123, \'xyz\', \'zara\', \'abc\']
print \"Max value element : \", max(list1);
It gives:
Max value e
It "orders" the words alphabetically and returns the one that is at the bottom of the alphabetic list (for the record, it doesn't not change the order of the items in your list, that's why I wrote "orders" inside quotation marks):
list1 = ["kyle", "darius"]
max(list1)
--> returns kyle because k is after d
list2 = ["kaula", "kzla", "kayla", "kwala"]
max(list2)
--> returns kzla because kz is alphabetically ordered after ka and kw
list3 = ["kyle", "darius", "janna", "set", "annie", "warwick", "bauuuuuu"]
max(list3)
--> returns warwick
I'm using python 3.7, and when I try to mix strings with numbers:
list4 = [13341412, "zara", "jane", "kada"]
max(list4)
I get an error:
Traceback (most recent call last): File "", line 1, in TypeError: '>' not supported between instances of 'str' and 'int'
At least in python 3.7, you cannot mix integers with strings.