Skip to content

Commit c14bd30

Browse files
author
joy
committed
kyclark#4 joy.y
1 parent c98c3a7 commit c14bd30

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

04_jump_the_five/jump.py

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Author : NowHappy <[email protected]>
4+
Date : 2021-10-02
5+
Purpose: Jump the Five
6+
"""
7+
8+
import argparse
9+
10+
11+
# --------------------------------------------------
12+
def get_args():
13+
"""Get command-line arguments"""
14+
15+
parser = argparse.ArgumentParser(
16+
description='Jump the Five',
17+
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
18+
19+
parser.add_argument('input',
20+
metavar='str',
21+
help='Input text')
22+
23+
return parser.parse_args()
24+
25+
26+
# --------------------------------------------------
27+
def main():
28+
"""Make a jazz noise here"""
29+
30+
args = get_args()
31+
text = args.input
32+
33+
jumper = { '1': '9',
34+
'2': '8',
35+
'3': '7',
36+
'4': '6',
37+
'5': '0',
38+
'6': '4',
39+
'7': '3',
40+
'8': '2',
41+
'9': '1',
42+
'0': '5'
43+
}
44+
45+
for char in args.input:
46+
print(jumper.get(char, char), end='')
47+
print()
48+
49+
50+
# --------------------------------------------------
51+
if __name__ == '__main__':
52+
main()

0 commit comments

Comments
 (0)