Skip to content

Commit

Permalink
Merge pull request #614 from santanu94/new_contrib
Browse files Browse the repository at this point in the history
Added Python code to move zeros to array end
  • Loading branch information
Srikant Singh authored Oct 31, 2018
2 parents be3297a + b951095 commit 3cfa926
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions HacktoberFestContribute/move_all_zeros_to_array_end.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Contribution from Santanu Bhattacharjee
# My GitHub account - https://github.com/santanu94

def move_zero_to_end(array = [5,0,2,0,3,0,4]):
array.sort(key= lambda x: True if x == 0 else False, reverse= False)
return array

print(move_zero_to_end([0,0,0,2,6,22,5,34,76,'a','tgf',65,0,'c']))

0 comments on commit 3cfa926

Please sign in to comment.