Define a function that can accept two strings as input and print the string with maximum length inthe console. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Define a function that can accept two strings as input and print the string with maximum length inthe console.

A function that can accept two strings as input and print the string with maximum length in console Define a function that can accept two strings as input and print the string with maximum length inthe console. If two strings have the same length, then the function should print all strings line by line. TDD Include tests for this program.

21st Aug 2018, 10:46 AM
Muwonge Nicholus
Muwonge Nicholus - avatar
3 Answers
21st Aug 2018, 11:12 AM
Rameshwor Nepal
Rameshwor Nepal - avatar
+ 2
def max_length(y): return max(y,key=len) x=input('enter two string with using space\n') print(max_length(x.split()))
21st Aug 2018, 11:38 AM
Maninder $ingh
Maninder $ingh - avatar
21st Aug 2018, 1:24 PM
Markus Kaleton
Markus Kaleton - avatar