Header Ads Widget

Write a python program to sort a string alphabetically

 code:-


mystring=input("Enter a string\n")
mylist=mystring.split()
mylist.sort()
mystring=''
for i in mylist:
mystring=mystring+' '+i
print("sorted string- ",mystring)

Output:-

Enter a string
this is easy coding zone
sorted string- coding easy is this zone



Post a Comment

1 Comments