diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/palindrome.py b/palindrome.py new file mode 100644 index 0000000..848b164 --- /dev/null +++ b/palindrome.py @@ -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() diff --git a/transform/Transform.py b/transform/Transform.py new file mode 100644 index 0000000..12a3432 --- /dev/null +++ b/transform/Transform.py @@ -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 diff --git a/transform/__init__.py b/transform/__init__.py new file mode 100644 index 0000000..e69de29