From 91ef29ce76c53eb016d55239afc64b12882f44dd Mon Sep 17 00:00:00 2001 From: maannsaayyy <61039502+maannsaayyy@users.noreply.github.com> Date: Thu, 1 Oct 2020 14:11:56 +0530 Subject: [PATCH] sort words Read the sentence and sort every word --- Basics/sort_word.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Basics/sort_word.py diff --git a/Basics/sort_word.py b/Basics/sort_word.py new file mode 100644 index 00000000..65c31823 --- /dev/null +++ b/Basics/sort_word.py @@ -0,0 +1,15 @@ +# wapp to read a sentence and sort every word of sentence + +def mysort(s): + ls=sorted(s) + ns=''.join(ls) + return ns + +s1=input("enter a sentence:") +l1=s1.split(" ") +ns1="" +for m in l1: + m=m[::-1] + ns1=ns1+" "+m +print(s1,ns1) +