+ 2

How do I make this output 5 names in alphabetical order?

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

11th Feb 2021, 7:26 AM
Vivian Anoemuah
Vivian Anoemuah - avatar
2 Answers
+ 5
Change your [input()] to input().split() to split every name as each element of the list. __________________ my_name = input() others = input().split() ... __________________ .split() splits the string by whitespace by default, for example: x = "This is a string" print(x.split()) >> ["This", "is", "a", "string"] You can learn more about split() method here: https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/ref_string_split.asp https://code.sololearn.com/c5A15a3A24A2
11th Feb 2021, 7:31 AM
noteve
noteve - avatar
0
import re str = "Regular expression test" print(re.split(" +", str)) http://net-informations.com/JUMP_LINK__&&__python__&&__JUMP_LINK/file/split.htm
24th Mar 2021, 4:47 AM
ronaldgevern