0
Please 🙏 🙏 🙏 I need to output city that has the minimum and maximum number of letters in a word
s = list (map (str, input())).split() print(s) print (f' {min(s, key = len)}\n{max(s, key = len)}') https://code.sololearn.com/cf1v7StsW1Za/?ref=app
2 Réponses
+ 12
murrr ,
when we use the input() function to take a text that has to be used as individual strings, we can use .split() directly with the string. using split() creates a list of strings by default.
we don't need map() to convert each of the words to a string, since input() returns a string by default. there is also no need of list() function.
we can do:
s = input().split()
print(f'{min(s, key = len)}\n{max(s,key = len)}')
+ 1
Thanks a lot !!!