From 6237f95de2ebe1cadb13a7bfcc0de815cea19fc3 Mon Sep 17 00:00:00 2001 From: takashivan Date: Tue, 13 Jan 2026 19:28:03 -0500 Subject: [PATCH 1/3] add functions to calculator --- .../calculator.cpython-313-pytest-9.0.2.pyc | Bin 0 -> 779 bytes __pycache__/calculator.cpython-313.pyc | Bin 0 -> 660 bytes ...test_calculator.cpython-313-pytest-9.0.2.pyc | Bin 0 -> 15832 bytes calculator.py | 15 +++++++++++++++ 4 files changed, 15 insertions(+) create mode 100644 __pycache__/calculator.cpython-313-pytest-9.0.2.pyc create mode 100644 __pycache__/calculator.cpython-313.pyc create mode 100644 __pycache__/test_calculator.cpython-313-pytest-9.0.2.pyc create mode 100644 calculator.py diff --git a/__pycache__/calculator.cpython-313-pytest-9.0.2.pyc b/__pycache__/calculator.cpython-313-pytest-9.0.2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..149685c424c8164da645e5c164ef24a6caca2dc4 GIT binary patch literal 779 zcma)3y>8S%5T3Q~F1||+2oe%dL|f2Y5nlxrLP1Iu2#pmf-Dz#_5i9=F?D`^8rJ&&f z@(_6!o?sggRCH1N0?clFK@?H4lE>fdd^_L#bkpes=zRaR%oqdsZJqV;deFTgZ~+lS z>;oWkfA7Fo9*2Vg4mm{LOTba&lii30WP@l(cKn&mMt^LQPsuu$^(^-3>#Xzz9JAda zz$=)sFV7B}TxWIOa(!0uvMFMTD!hbC&oE(Ftn5?H&EEV-QDm;gsZb|bEXw)5T*Z zQMXzu9STJ|v}+1co?)h?8Q)%+jrHAx9$WfCpj(w2pli&@-i*MG@n*)s+oDRFT)xBS dbZ7UfcF0`$jIkd8U*Q@&wtXF}O=po?!(T-=rJeu) literal 0 HcmV?d00001 diff --git a/__pycache__/calculator.cpython-313.pyc b/__pycache__/calculator.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..861a25fc8f4f848f13c79a0c8573dbdb6d6e4543 GIT binary patch literal 660 zcma)3J5Iwu5S_IXFyx~Ii2_8i1x<>?6&*q#r34xaiFW-7Sojl-*Fm95n*-z!xeF(7 zh2R1xz5ufu2Z%61C}a%aOBI`-T1R(>F!p~v2i@A627<7mp|Ys!;6b_2`?OIR8O69scK z^(*Jawf&IM7h8%Kkv)g5NbF%S38Hiy2Z^*tdE&`1O|pJPm=M7ek(Wn8rZ^Z+3oEXa z(4v;gNqImpgO5gYelfc(sem0*6GKnkx$*r!1EX?>HG*nj+^4)Sh3{jNGO`P(8EbNd> zOWFCAx$o8VVzpg8h9<2CR;Je*u`c7(&!gZ9yYx=oLUuy%Z8FAIhQYckYXhaq^uB%o Dw;X%i literal 0 HcmV?d00001 diff --git a/__pycache__/test_calculator.cpython-313-pytest-9.0.2.pyc b/__pycache__/test_calculator.cpython-313-pytest-9.0.2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..83bd533c8b4fdefee34c67d38c259162190ef94f GIT binary patch literal 15832 zcmeHO-ESLN6`!%kP8{dUN&2HgXfU8AT0O`0&lz^;AO?z@?AR$HK0d0|x$_u}9=gys(#Jf&f zvJ};peSGfMxo2js@BHR>jvutOwJ3P$f4MpT9iO87l?v9&Ba{b|P=2iFimtw@FqMCM zCcTCytW0Xm7dBh`%&&W%QCO4ig>2R}$bjyHY|;IYLA?pG^_CiG-XX)U%?k7Us~OUZ z&x7Cj`CO{*c~zNIa|*0`bE>Z8!~M#1S5o+t^Xk6*%V}-=6-CLX2ZW`$e=Ev$O%#+V zSla#SS9E{cmr(Vl=|sYl6n*vP>oh-qP4V+#mCWycB`GRi#P{4u*DS5>zEtX0(n?Y_ z>n-0hM_r@ZKYP^cDtxk!q;_xBnxk${&%S$l_uW&odg_7mzCoPpoZsO`XRYJYTjZGF zAUf!+Y5%aw$2MK>wnjLt^jLNFH_mO7WySi=Vogq{ITardKHdp+=?xuay=~8`Q5&nq zI%|&eTzh>zDXXU4@>oCoRnw6VomFxky)*wV_L~8@-(V-p|NN|y|8+XZ_na%%?|Pqm zj)pxaH2t%uXwPZ3u3Fu77T9-Bd;j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CzqTaHOr0Q6dPBqptKwh-D8=GIXr%}VEJq~KATXx3`<5!o2$bhuaJDtpCIPHzUu0dHg?dcU@3Vn_a$P0=@YUa2GK-u-9-@?CT_6 zhgh*0EdVu(0gH~tQtWHgM}o5*iZi;vnbkQ3a2DG?IOA9i=!{)+PtU=aWpglPb8r^^ z;yxb`fAKLj@E4n+gF8n;;x3+s##7U3;n2(O%y$A zDJaDP7ZnN`2|z?>3&fQR9ue9~$T~t>qC{xRV>S@l662s23$i<*ty3;@W)q<;$}by& zH|p9b6r#f*?q0aB4Vmu^v|^|znaUQ8kaZQiga*ngqt2W5IH<&e2@{y0e8OeUY{Ep_ zA)K0I5ka=3b$*hB|B^+X|HcRe3P454Za7v~N*X1*!7T^m5+#CMAscduag^Z(XGM3+ zQa{T7=q;Qv9gs@f##%;$kG(>kL6 zy6`+i9AGC+(U#@&LsVZtFj~13;?) literal 0 HcmV?d00001 diff --git a/calculator.py b/calculator.py new file mode 100644 index 0000000..964635b --- /dev/null +++ b/calculator.py @@ -0,0 +1,15 @@ +def multiply(a, b): + """Multiply two numbers.""" + return a * b + +def add(a, b): + """Add two numbers.""" + return a + b + +def subtract(a, b): + """Subtract b from a.""" + return a - b + +def divide(a, b): + """Divide a by b.""" + return a / b From 158bd40913983bbd3b8e8f63d0c361c20a360d9a Mon Sep 17 00:00:00 2001 From: takashivan Date: Tue, 13 Jan 2026 19:31:47 -0500 Subject: [PATCH 2/3] Add example code demonstrating multiply function usage Added code at the bottom of calculator.py that prints an explanation message, calls the multiply function with arguments 5 and 6, and prints the result. This demonstrates how to use the calculator functions. --- calculator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/calculator.py b/calculator.py index 964635b..7d01890 100644 --- a/calculator.py +++ b/calculator.py @@ -13,3 +13,7 @@ def subtract(a, b): def divide(a, b): """Divide a by b.""" return a / b + +print("I'm going use the calculator functions to multiply 5 and 6") +x = multiply(5,6) +print(x) From 00860d2f25005125cfcca1873e2ba395e3c370b8 Mon Sep 17 00:00:00 2001 From: takashivan Date: Tue, 13 Jan 2026 19:40:29 -0500 Subject: [PATCH 3/3] Add square, cube, and square_n_times functions Added three new functions to calculator.py: - square: takes a single number and returns it raised to the power of 2 - cube: takes a single number and returns it raised to the power of 3 - square_n_times: takes a number and n, squares the number n times sequentially, and returns the sum of all intermediate values --- .../calculator.cpython-313-pytest-9.0.2.pyc | Bin 779 -> 938 bytes calculator.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/__pycache__/calculator.cpython-313-pytest-9.0.2.pyc b/__pycache__/calculator.cpython-313-pytest-9.0.2.pyc index 149685c424c8164da645e5c164ef24a6caca2dc4..8354e54aa9b61318e89cb3af04da35b4583e6088 100644 GIT binary patch delta 286 zcmeBXTg9&anU|M~0SFd9PRmSWWMFs<;=lk4l<_%ZqPn?F43`o^FqLnYH(BzpM z#gxu2~=ai9<%IT#q( hF0eUWVQ{|5!qXAhQP}L;z<85^wIQ*Uqlg=*9{?F=LoxsW delta 148 zcmZ3*-p!`|nU|M~0SL}KO3P$qWMFs<;=lkCl=0bYqPjU(I-@4rOOS})hU}j`wywAYU!tjZK QiBa$q2aNa(VuAGo0Di|D(*OVf diff --git a/calculator.py b/calculator.py index 7d01890..7318e6e 100644 --- a/calculator.py +++ b/calculator.py @@ -14,6 +14,23 @@ def divide(a, b): """Divide a by b.""" return a / b +def square(a): + """Square a number.""" + return a ** 2 + +def cube(a): + """Cube a number.""" + return a ** 3 + +def square_n_times(number, n): + """Square the number n times and return the sum of all intermediate values.""" + result = number + total = number + for i in range(n): + result = result ** 2 + total += result + return total + print("I'm going use the calculator functions to multiply 5 and 6") x = multiply(5,6) print(x)