Skip to content

Instantly share code, notes, and snippets.

@solen003
Created July 15, 2018 20:35
Show Gist options
  • Save solen003/71e43a92083def35388828830597e898 to your computer and use it in GitHub Desktop.
Save solen003/71e43a92083def35388828830597e898 to your computer and use it in GitHub Desktop.
Write a program that accepts a comma separated sequence of words as input and prints the words in a comma-separated sequence after sorting them alphabetically. Suppose the following input is supplied to the program: without,hello,bag,world Then, the output should be: bag,hello,without,world
phrase = input("Input words: ")
phrase_list = phrase.split(",")
phrase_list.sort()
print((', ').join(phrase_list))
@Bala-kr
Copy link

Bala-kr commented Sep 11, 2022

Write a program that accepts a comma - separated sequence of
words as input and prints the words in a comma - separated
sequence after sorting them alphabetically .
Sample Input
order , hello , would , test
Sample Output
hello , order , test , would

// I want this problem answer please send anyone

@Amritrajdubey
Copy link

Wrong code , at least run once before posting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment