PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def sort(lst):
return sorted(lst)
def reverse_string(s):
return s[::-1]
def reverse_string_list(lst):
lst_word_r = []
for word in lst:
lst_word_r.append(reverse_string(word))
return lst_word_r
#input:
lst = ["apple","ztc","python"]
print ("Input")
print (lst)
#reverse words in list:
lsr = reverse_string_list(lst)
print ("Reverse word")
print (lsr)
#order:
lsro = sort(lsr)
print ("Sort")
print (lsro)
#reverse words again
lsror = reverse_string_list(lsro)
print ("Reverse word again")
print (lsror)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run