+ 2

What if I have 50 names? How to make it simpler? Any suggestions

https://code.sololearn.com/ce6iNaZ3Z5f0/?ref=app

18th May 2020, 5:32 AM
Karthik
Karthik - avatar
4 Answers
+ 2
https://code.sololearn.com/cQQvIyMsCHW5/?ref=app For loop
18th May 2020, 6:14 AM
Justus
Justus - avatar
+ 1
secrets = [x[0].upper() for x in friends]
18th May 2020, 6:44 AM
GeorgeT
0
#use for loop bro ;) def society_name(friends): secret="" for friend in friends: secret += friend[0].upper() x=sorted(secret) y=("").join(x) return y print(society_name(["karthik","sara","Jane"]))
19th May 2020, 3:27 AM
Ahmed Muhammed
Ahmed Muhammed - avatar
0
sec = [name.capitalize()[0] for name in friends]
19th May 2020, 6:05 AM
NGL
NGL - avatar