← Back to Lists
Question 148
Longest Name
Longest Name
The second element of the list names is read from input() with no prompt. Find the longest name with a for loop, comparing lengths from len() and keeping the current best in longest, which starts as the first name; when lengths tie the earlier name stays. After the loop print <name> has <n> letters. Input: one line, a name.
Expected Output:
Giselle has 7 letters= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Lists
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.