diff --git a/printNumbers/functions/adding_numbers.py b/printNumbers/functions/adding_numbers.py new file mode 100644 index 0000000..5f01f42 --- /dev/null +++ b/printNumbers/functions/adding_numbers.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# +# factorial.py +# +# This file is part of printNumbers. +# +# Copyright (C) 2017 G. Trensch, Simulation & Datalab Neuroscience, JSC, FZ Juelich +# +# printNumbers is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# printNumbers is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with printNumbers. If not, see . + +import math + +def Adding_same_number(n): + ''' + :param n: Operand + :return: n+n + ''' + return(n+n) diff --git a/printNumbers/parameters.py b/printNumbers/parameters.py index aebe0c3..33eb692 100755 --- a/printNumbers/parameters.py +++ b/printNumbers/parameters.py @@ -25,10 +25,10 @@ CONST_VERSION = 'V1.0' CONST_VERSION_STRING = '+ + PrintNumbers ' + CONST_VERSION + ' (Software Development in Science) + +' -CONST_DEF_OPERAND_VAL = 10 -CONST_MAX_OPERAND_VAL = 20 +CONST_DEF_OPERAND_VAL = 100 +CONST_MAX_OPERAND_VAL = 20= CONST_FUNC_CODE_FIBONACCI = 0 -CONST_FUNC_CODE_FACTORIAL = 1 +CONST_FUNC_CODE_FACTORIAL = 10 class Parameters(object): diff --git a/printNumbers/printNumbers.py b/printNumbers/printNumbers.py index 9f9ef0e..1392c2b 100755 --- a/printNumbers/printNumbers.py +++ b/printNumbers/printNumbers.py @@ -39,12 +39,14 @@ from parameters import * from functions.fibonacci import * from functions.factorial import * +from functions.adding_numbers import * # # FUNCTION TABLE # functionTable = { CONST_FUNC_CODE_FIBONACCI : FibonacciSequence, CONST_FUNC_CODE_FACTORIAL : Factorial, + CONST_FUNC_CODE_Adding : Adding_same_number, } # @@ -67,3 +69,5 @@ print('fib(' + str(params.operand) + ') =', result) elif params.functionIndex == CONST_FUNC_CODE_FACTORIAL: print(str(params.operand) + '! =', str(result)) + elif params.functionIndex == CONST_FUNC_CODE_Adding: + print('add(' + str(params.operand) + ') =', result)