Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit c0d13d3

Browse files
authored
Merge pull request vJechsmayr#777 from ViKrAm-Bais/master
this fixes vJechsmayr#761
2 parents d67df40 + db46e00 commit c0d13d3

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution:
2+
def reverseWords(self, s):
3+
list_of_string = s.split(' ')
4+
#appliying filter function to remove extraspaces from list
5+
new_list = list(filter(lambda x : True if (x!="") else False, list_of_string))
6+
#taking reverse of output list
7+
new_list.reverse()
8+
#joining the elements if list
9+
final_string = " ".join(str(k) for k in new_list)
10+
return final_string

0 commit comments

Comments
 (0)