Add project structure
This commit is contained in:
parent
cf184f7747
commit
350087354a
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
__pycache__
|
32
palindrome.py
Normal file
32
palindrome.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
import argparse
|
||||
from transform.Transform import Transform
|
||||
|
||||
|
||||
def parse_args():
|
||||
'''
|
||||
Argument Parser for terminal usage.
|
||||
'''
|
||||
parser = argparse.ArgumentParser(description=('Throw in an integer N to'
|
||||
'transform it into a'
|
||||
'palindrome'))
|
||||
parser.add_argument('-i',
|
||||
'--int',
|
||||
nargs=1,
|
||||
required=True,
|
||||
help='The integer to be transformed.',
|
||||
type=int)
|
||||
args = parser.parse_args()
|
||||
return args
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
print(args.int)
|
||||
print(Transform.palindrome(args.int))
|
||||
return args
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
11
transform/Transform.py
Normal file
11
transform/Transform.py
Normal file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
class Transform(object):
|
||||
"""Class to transform a given integer into a palindrome"""
|
||||
|
||||
def __init__(self):
|
||||
super(Transform, self).__init__()
|
||||
|
||||
@staticmethod
|
||||
def palindrome(int):
|
||||
return int
|
0
transform/__init__.py
Normal file
0
transform/__init__.py
Normal file
Loading…
Reference in New Issue
Block a user