Skip to content

Commit da0d2ba

Browse files
committed
exercise 04
1 parent 10e68f0 commit da0d2ba

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

04_jump_the_five/jump.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#! /usr/bin/env python3
2+
3+
import argparse
4+
5+
def get_args():
6+
7+
parser = argparse.ArgumentParser(
8+
prog='jumpy',
9+
description='The program decode a phone number',
10+
epilog='This is an epilog')
11+
12+
parser.add_argument('str',
13+
help='Text to decode',
14+
type=str)
15+
16+
return parser.parse_args()
17+
18+
def main():
19+
# Read program input arguments
20+
args = get_args()
21+
22+
text = args.str
23+
24+
jumper ={
25+
'1':'9',
26+
'2':'8',
27+
'3':'7',
28+
'4':'6',
29+
'5':'0',
30+
'6':'4',
31+
'7':'3',
32+
'8':'2',
33+
'9':'1',
34+
'0':'5'}
35+
36+
for char in text:
37+
print(jumper.get(char, char), end='')
38+
39+
print()
40+
41+
if __name__ == '__main__':
42+
main()
43+
44+

0 commit comments

Comments
 (0)