⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions printNumbers/functions/adding_numbers.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.

import math

def Adding_same_number(n):
'''
:param n: Operand
:return: n+n
'''
return(n+n)
6 changes: 3 additions & 3 deletions printNumbers/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
4 changes: 4 additions & 0 deletions printNumbers/printNumbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

#
Expand All @@ -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)