-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchallenge_2.py
More file actions
39 lines (28 loc) · 893 Bytes
/
challenge_2.py
File metadata and controls
39 lines (28 loc) · 893 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
def main():
pairs = [
(230301, 233100),
(1203045600789, 1234567890000),
]
for start, end in pairs:
start = [int(i) for i in str(start)]
end = [int(i) for i in str(end)]
if shove_zeroes_right(start) == end:
print(f"{start} sorted is {end}: CORRECT!")
else:
print(
f"Whups, {start} resulted in {shove_zeroes_right(start)} "
f"instead of {end}. WRONG!"
)
def shove_zeroes_right(numbers):
"""
Accepts a list of integers, and returns the list with any entries equal to zero moved to the
right, but all other numbers in the same order.
For example:
[1, 0, 4, 4, 2, 0, 7, 0, 9]
would return:
[1, 4, 4, 2, 7, 9, 0, 0, 0]
"""
pass # TO BE IMPLEMENTED
if __name__=='__main__':
main()