diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2024-01-21 17:57:17 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-21 17:57:17 +0000 |
| commit | 0cc193c86d63fb566b88a2d447147faa95b2715e (patch) | |
| tree | ae4bf5763997749e4a6543f602bc7ef7f248deb7 /challenge-252/deadmarshal/python/ch2.py | |
| parent | 77f823797c2b56f60f7429970826c5f006072193 (diff) | |
| parent | 6a30f27182af9a9ae0ce1a671bc49d2065a8164b (diff) | |
| download | perlweeklychallenge-club-0cc193c86d63fb566b88a2d447147faa95b2715e.tar.gz perlweeklychallenge-club-0cc193c86d63fb566b88a2d447147faa95b2715e.tar.bz2 perlweeklychallenge-club-0cc193c86d63fb566b88a2d447147faa95b2715e.zip | |
Merge pull request #9434 from deadmarshal/TWC252
TWC252
Diffstat (limited to 'challenge-252/deadmarshal/python/ch2.py')
| -rw-r--r-- | challenge-252/deadmarshal/python/ch2.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-252/deadmarshal/python/ch2.py b/challenge-252/deadmarshal/python/ch2.py new file mode 100644 index 0000000000..17868430ab --- /dev/null +++ b/challenge-252/deadmarshal/python/ch2.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +def unique_sum_zero(n): + ret = [] + for i in range(1,n//2+1): + ret += [i,-i] + if n % 2 != 0: ret.append(0) + return ret + +print(unique_sum_zero(5)) +print(unique_sum_zero(3)) +print(unique_sum_zero(1)) |
