# 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
str = input("Enter a comma seprated string : ")
if len(str)>0:
sstr=""
wordList = str.split(",")
wordList = sorted(wordList)
for w in wordList:
sstr +=w
sstr +=","
sstr = sstr[:-1]
print("Sorted String : ",sstr)
else:
print("String is empty.")
input("Press Enter to exit.")
If you have a great ability of thinking, imagination and visualisation than you have to codes your thinking and visualisation.
Wednesday, 13 June 2018
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 Using Python Programming.
Subscribe to:
Post Comments (Atom)
Featured post
In all other cases the driver is not insured. If the marital status, sex and age of the driver are the inputs, write a program to determine whether the driver is to be insured or not.
#include #include int main() { char ms; printf("Is Driver married (Y/N): "); scanf("%c",&ms); if(ms=='y...
Popular Posts
-
# Python Program To demonstrate inheritance. # Parent Class class parentCls: def __init__(self): print("Parent Cl...
-
# To implement Queue using list queueList = [] def enQueue(ele='\0'): if ele!='\0': queueList.append(...
-
#Python program to demonstrate constructors # declaration of class class myClass: def __init__(self,fName,lName): # Constructor...
No comments:
Post a Comment