2 ответов
+ 1
So by "largest value" you actually mean "longest word"?
There are several ways to accomplish this. One a approach could be this:
* create a variable x that will hold the max length and initialize it with 0
* create a variable y that will hold the longest word and initiize it as empty string
* iterate over the list
* on each iteration, get the length of the current word. If the current word is longer than x, update x with the length of the current word and set y to the current word.
* after the loop, print y; it will be the longest word
Example approaches:
https://www.geeksforgeeks.org/JUMP_LINK__&&__python__&&__JUMP_LINK-longest-string-in-list/