A code snippet which accepts a word or a sentence from a user, and then sorts it, and displays the sorted list.
Alphabet sorter
# An empty list
sorter=[]
# A for loop to add whatever the user enters to the list
for a in (raw_input("Enter some words/letters to sort in alphabetical order: ")):
sorter.append(a)
print sorted(sorter)
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.