Write a python program to sort a string alphabetically

 code:-

mystring=input(“Enter a stringn”)
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



One thought on “Write a python program to sort a string alphabetically

Leave a Reply

Your email address will not be published.