From 90f0e44e22824b19db43eea59de3c5d3518f86e7 Mon Sep 17 00:00:00 2001 From: Daniel Heras Quesada Date: Fri, 14 Nov 2025 23:00:38 +0100 Subject: [PATCH] feat: main structure + basic math testing --- Makefile | 3 ++ main.py | 2 -- src/main.py | 8 ++++++ src/modules/__pycache__/math.cpython-313.pyc | Bin 0 -> 1557 bytes .../__pycache__/strings.cpython-313.pyc | Bin 0 -> 406 bytes src/modules/math.py | 26 ++++++++++++++++++ src/modules/strings.py | 3 ++ 7 files changed, 40 insertions(+), 2 deletions(-) delete mode 100644 main.py create mode 100644 src/main.py create mode 100644 src/modules/__pycache__/math.cpython-313.pyc create mode 100644 src/modules/__pycache__/strings.cpython-313.pyc create mode 100644 src/modules/math.py create mode 100644 src/modules/strings.py diff --git a/Makefile b/Makefile index f4db715..2d3cb55 100644 --- a/Makefile +++ b/Makefile @@ -3,5 +3,8 @@ install: pip install --upgrade pip pip install -r requirements.txt +run: + python src/main.py + test: python -m pytest -v diff --git a/main.py b/main.py deleted file mode 100644 index d4a8ddd..0000000 --- a/main.py +++ /dev/null @@ -1,2 +0,0 @@ -if __name__ == "__main__": - print("This is a test") diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..2014185 --- /dev/null +++ b/src/main.py @@ -0,0 +1,8 @@ +from modules.math import t_compound_interest, t_compound_interest_algorigthm, t_exponent +from modules.strings import t_strings + +if __name__=="__main__": + t_strings() + t_exponent(2,8) + print(t_compound_interest(100, 20 / 100, 2, 12)) + print(t_compound_interest_algorigthm(100, 20 / 100, 2, 12)) diff --git a/src/modules/__pycache__/math.cpython-313.pyc b/src/modules/__pycache__/math.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb1aa6039afb33f811b37158d4b1396667031e7a GIT binary patch literal 1557 zcmbtU&ube;6n?Y2TCKEJ6kE1j3prJq&0$kZDsA0Dag~?^8d@v}i$Rcs*hpJRMcP$n zSH-@GoLmY)7efg-^i=BqM#50S;6S0h=$2ZS=GOOiC1W?oJlJpE%$u3_<9oBSR4NH5 z+27VX|4IOV(PSYw4`p@_hhwn7V&B2Hj7x<`mr-Y^OF7_*B_qZx1yQwPh;d6r)T}sS zqNSOMDP4BLgxvL74bm49M@7bO_7%c0JZ1}n#d7eNETLGEC2!AT%E0z~b$hv=4t|E;YzyHQ6!7YO$iPEP*ku;%vtkV3M>viZU~dUP#~m&9rTjfJr75|oo`5L{ zsq~3p9iJ8o1#z$3_Igga`PA(+%MZN9py#-OU%u}(opS#$XnSt)$zjnsuzUTkQ}%hI z-1C})uH%<`cF->M4@F|9<+#p4pI5|2Q1=JDUTLT6HSDfmDP5STBK|7E6oxR?jTgDm z?$Pd%{rvum+*@Bk!?TrDHl=K*DgwqS<5eQYZMWrc4VPy40oM_P8u{TFoM6h}Zy*fe zZ%v=*#>=%|p8mT0GIy#Qrl|OYZW_WXZRw|LW0rl_C8Zd;q!X80qQ(|2U;tl3Bd2XA zl3*^+qISi#9@MedY~BglJ)TD^(hNSq5Y7@yM~{BakEONu@oqAqH#{QyfL!t1|3kPM8NMmI+XlXY{la_9Hfi91>TdZJavtnzN?)R`fPZB!_9SGoMQ_oW4u_$aX?ZtRNn z(p!Isl(}l{!8~zF87t>1dzdRd+r697xUWPdp!PEvU#20>(Fpt_f?EUzf>5yh7Tv~U{1Xgk`e|H5*^+U1+MKx|CE)eYmBX* StBhp{HVN*|RF$Q}tNsJ+7BI5_ literal 0 HcmV?d00001 diff --git a/src/modules/__pycache__/strings.cpython-313.pyc b/src/modules/__pycache__/strings.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1cfcf5cf89c8c70e62d3ca96eab6f438186f6ee9 GIT binary patch literal 406 zcmZ9I%}T>S5XWcJ+O%r%C{ctQjZ*g{ejr}zxd*E!4<$Bh6G*agcO%9kOqvnn=c^b1)QzT#bIY=XXZEmg{`{XWk7p9up@@~+Z45t#icUH6AWPk1Wbr$jcdZ> z7J37{I>dk!N#UyAgiAO#vwt?UhK(b#zo1;0fY%&6tY3tYbn*D^oge4y*qtgS)uXok zl&g>lkLaf9c$QwuM3gGsy5S=66%JOCVx(A-#Xb^7*wuX+@`TagHjM&$#>aWWQYC4h z2aINg3VGVQE_&?V$1O&s7}JCYdCVl03e_iaFDrCMjTV*YpsG=pTNq0CT-z=;zeuZ` ze%Q{N?K~GV+nL$kJK3oafPqKmD=#3-|A{sR-9Gty<5a9-Iaf2op9UeMvMjPYXMX|Z C0$!y6 literal 0 HcmV?d00001 diff --git a/src/modules/math.py b/src/modules/math.py new file mode 100644 index 0000000..9b83bbf --- /dev/null +++ b/src/modules/math.py @@ -0,0 +1,26 @@ +from cmath import log as complex_log # used for complex numbers +from math import log + + +def t_summ(): + # Equivalent to summatory of 2*i from i=1 to i=5 + return sum(2*i for i in range(1,6)) + +def t_exponent(base, exponent): + return base**exponent + +def t_logarithm(n, base): + return log(n, base) + +def t_complex_logarithm(n, base): + return complex_log(n, base) + +def t_compound_interest(input, interest, span, periods): + return input * ((1 + (interest / periods))**(periods * span)) + +def t_compound_interest_algorigthm(input, interest, span, periods): + result = input + for _ in range(0, span): + for _ in range(0, periods): + result += result * (interest / periods) + return result diff --git a/src/modules/strings.py b/src/modules/strings.py new file mode 100644 index 0000000..9463f2a --- /dev/null +++ b/src/modules/strings.py @@ -0,0 +1,3 @@ +def t_strings(): + my_template = "This is a value: {test}" + print(my_template.format(test="another"))