Skip to content

Commit

Permalink
Use None to remove empty strings
Browse files Browse the repository at this point in the history
  • Loading branch information
resorcap committed Mar 8, 2015
1 parent 80be243 commit 629ad80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Reverse Words in a String.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class Solution:
def reverseWords(self, s):
return " ".join(filter(lambda x: x, reversed(s.split(" "))))
return " ".join(filter(None, reversed(s.split(" "))))

0 comments on commit 629ad80

Please sign in to comment.