+ 1
How to find highest number in list?
My list having integer and string but I need to find highest number by excluding string Should I try statement? Is there any other way https://code.sololearn.com/crt6oPCffBLs/?ref=app
3 ответов
+ 4
lst=['1','3','002','0000','x','chef']
print(max([int(n) for n in lst if n.isnumeric()]))
Don't use "list" as a name for a list! 😤
+ 3
Nice. One line is all it takes, this shows how expressive the language can be.
+ 1
Thank you Anna