max & min methods in lists | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

max & min methods in lists

what's the return value of max or min methods if the list contains strings like this example: x = ["hello", "world"] print(max(x))

2nd Aug 2016, 7:23 AM
Ali
Ali - avatar
4 Answers
+ 1
Max value is. World. Min value is hello Cuz max starts from the right side in the order of alphabet :)
2nd Aug 2016, 11:03 AM
shin eun kyung
shin eun kyung - avatar
0
so, basically because 'w' is greater than 'h', so world is the max and hello is the min ?
2nd Aug 2016, 11:10 AM
Ali
Ali - avatar
0
Yes. Right- You can also check with playground menu in this app
2nd Aug 2016, 11:18 AM
shin eun kyung
shin eun kyung - avatar
0
thanks shin eun kyung for your help :)
2nd Aug 2016, 11:23 AM
Ali
Ali - avatar