From 9d4ddc9173168f76f01f8939b83cb23afb00dadc Mon Sep 17 00:00:00 2001 From: Aratrika Gupta <157571977+Aratrika-Gupta@users.noreply.github.com> Date: Sun, 22 Mar 2026 13:48:15 +0530 Subject: [PATCH 1/6] Added Trigonometry Module --- .github/workflows/calculator.py | 41 +++++++++++++++++++ .github/workflows/test_calculator.py | 33 +++++++++++++++ .../workflows/trigonometry_module/__init__.py | 0 .../trigonometry_module/test_trigonometric.py | 28 +++++++++++++ .../trigonometry_module/trigonometric.py | 33 +++++++++++++++ 5 files changed, 135 insertions(+) create mode 100644 .github/workflows/calculator.py create mode 100644 .github/workflows/test_calculator.py create mode 100644 .github/workflows/trigonometry_module/__init__.py create mode 100644 .github/workflows/trigonometry_module/test_trigonometric.py create mode 100644 .github/workflows/trigonometry_module/trigonometric.py diff --git a/.github/workflows/calculator.py b/.github/workflows/calculator.py new file mode 100644 index 0000000..0c52c8f --- /dev/null +++ b/.github/workflows/calculator.py @@ -0,0 +1,41 @@ +import re +from trigonometry_module.trigonometric import Trigonometric + +class Calculator: + + def __init__(self, mode="degree"): + self.trig = Trigonometric(mode) + + def add(self, a, b): + return a + b + + def subtract(self, a, b): + return a - b + + def multiply(self, a, b): + return a * b + + def divide(self, a, b): + if b == 0: + raise ValueError("Division by zero") + return a / b + + def evaluate(self, expr): + expr = expr.replace(" ", "") + + functions = [ + ("asin", self.trig.asin), + ("acos", self.trig.acos), + ("atan", self.trig.atan), + ("sinh", self.trig.sinh), + ("cosh", self.trig.cosh), + ("tanh", self.trig.tanh), + ("sin", self.trig.sin), + ("cos", self.trig.cos), + ("tan", self.trig.tan), + ] + + for name, func in functions: + expr = re.sub(rf'{name}\((.*?)\)', lambda m: str(func(m.group(1))), expr) + + return eval(expr) \ No newline at end of file diff --git a/.github/workflows/test_calculator.py b/.github/workflows/test_calculator.py new file mode 100644 index 0000000..7cb79e9 --- /dev/null +++ b/.github/workflows/test_calculator.py @@ -0,0 +1,33 @@ +import unittest +from calculator import Calculator + +class TestCalculator(unittest.TestCase): + # base test cases + def setUp(self): + self.calc = Calculator() + + def test_add(self): + self.assertEqual(self.calc.add(2, 3), 5) + + def test_sub(self): + self.assertEqual(self.calc.subtract(2, 3), -1) + + def test_multiply(self): + self.assertEqual(self.calc.multiply(2, 3), 6) + + def test_divide(self): + self.assertEqual(self.calc.divide(2, 4), 0.5) + + def test_divide(self): + self.assertEqual(self.calc.divide(4, -2), -2) + + def test_divide_fail(self): # this will fail + self.assertNotEqual(self.calc.divide(4, -2), 2) + + def test_divide_by_zero(self): + with self.assertRaises(ValueError): + self.calc.divide(5, 0) + +# Optional: this allows running the script directly + if __name__ == '__main__': + unittest.main() # diff --git a/.github/workflows/trigonometry_module/__init__.py b/.github/workflows/trigonometry_module/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/trigonometry_module/test_trigonometric.py b/.github/workflows/trigonometry_module/test_trigonometric.py new file mode 100644 index 0000000..2559101 --- /dev/null +++ b/.github/workflows/trigonometry_module/test_trigonometric.py @@ -0,0 +1,28 @@ +import unittest +from calculator import Calculator + +class TestTrigonometric(unittest.TestCase): + + def setUp(self): + self.calc = Calculator() + + def test_sin(self): + self.assertAlmostEqual(self.calc.evaluate("sin(30)"), 0.5, places=2) + + def test_cos(self): + self.assertAlmostEqual(self.calc.evaluate("cos(60)"), 0.5, places=2) + + def test_tan(self): + self.assertAlmostEqual(self.calc.evaluate("tan(45)"), 1.0, places=2) + + def test_expression(self): + self.assertAlmostEqual(self.calc.evaluate("2 + 3*sin(30)"), 3.5, places=2) + + def test_inverse(self): + self.assertAlmostEqual(self.calc.evaluate("asin(0.5)"), 30, places=2) + + def test_hyperbolic(self): + self.assertAlmostEqual(self.calc.evaluate("sinh(0)"), 0.0, places=2) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/.github/workflows/trigonometry_module/trigonometric.py b/.github/workflows/trigonometry_module/trigonometric.py new file mode 100644 index 0000000..b3f7f3b --- /dev/null +++ b/.github/workflows/trigonometry_module/trigonometric.py @@ -0,0 +1,33 @@ +import math + +class Trigonometric: + + def to_radians(self, x): + return math.radians(float(x)) + + def sin(self, x): + return math.sin(self.to_radians(x)) + + def cos(self, x): + return math.cos(self.to_radians(x)) + + def tan(self, x): + return math.tan(self.to_radians(x)) + + def asin(self, x): + return math.degrees(math.asin(float(x))) + + def acos(self, x): + return math.degrees(math.acos(float(x))) + + def atan(self, x): + return math.degrees(math.atan(float(x))) + + def sinh(self, x): + return math.sinh(float(x)) + + def cosh(self, x): + return math.cosh(float(x)) + + def tanh(self, x): + return math.tanh(float(x)) \ No newline at end of file From 98831d0b12b5faa69dd534fecea260e3917f58fc Mon Sep 17 00:00:00 2001 From: shareef-afzal Date: Sun, 29 Mar 2026 17:49:11 +0530 Subject: [PATCH 2/6] added exceptions.py , improved error handling , changes the folder structure --- .github/workflows/calculator.py | 41 ------------------ .github/workflows/test_calculator.py | 33 -------------- __pycache__/calculator.cpython-313.pyc | Bin 0 -> 3197 bytes __pycache__/exceptions.cpython-313.pyc | Bin 0 -> 1162 bytes __pycache__/test_calculator.cpython-313.pyc | Bin 0 -> 2805 bytes calculator.py | 35 +++++++++++++++ exceptions.py | 18 ++++++++ .../__init__.py | 0 .../__pycache__/__init__.cpython-313.pyc | Bin 0 -> 187 bytes .../__pycache__/trigonometric.cpython-313.pyc | Bin 0 -> 2863 bytes .../test_trigonometric.py | 20 +++++++++ .../trigonometric.py | 11 ++++- 12 files changed, 82 insertions(+), 76 deletions(-) delete mode 100644 .github/workflows/calculator.py delete mode 100644 .github/workflows/test_calculator.py create mode 100644 __pycache__/calculator.cpython-313.pyc create mode 100644 __pycache__/exceptions.cpython-313.pyc create mode 100644 __pycache__/test_calculator.cpython-313.pyc create mode 100644 exceptions.py rename {.github/workflows/trigonometry_module => trigonometry_module}/__init__.py (100%) create mode 100644 trigonometry_module/__pycache__/__init__.cpython-313.pyc create mode 100644 trigonometry_module/__pycache__/trigonometric.cpython-313.pyc rename {.github/workflows/trigonometry_module => trigonometry_module}/test_trigonometric.py (55%) rename {.github/workflows/trigonometry_module => trigonometry_module}/trigonometric.py (64%) diff --git a/.github/workflows/calculator.py b/.github/workflows/calculator.py deleted file mode 100644 index 0c52c8f..0000000 --- a/.github/workflows/calculator.py +++ /dev/null @@ -1,41 +0,0 @@ -import re -from trigonometry_module.trigonometric import Trigonometric - -class Calculator: - - def __init__(self, mode="degree"): - self.trig = Trigonometric(mode) - - def add(self, a, b): - return a + b - - def subtract(self, a, b): - return a - b - - def multiply(self, a, b): - return a * b - - def divide(self, a, b): - if b == 0: - raise ValueError("Division by zero") - return a / b - - def evaluate(self, expr): - expr = expr.replace(" ", "") - - functions = [ - ("asin", self.trig.asin), - ("acos", self.trig.acos), - ("atan", self.trig.atan), - ("sinh", self.trig.sinh), - ("cosh", self.trig.cosh), - ("tanh", self.trig.tanh), - ("sin", self.trig.sin), - ("cos", self.trig.cos), - ("tan", self.trig.tan), - ] - - for name, func in functions: - expr = re.sub(rf'{name}\((.*?)\)', lambda m: str(func(m.group(1))), expr) - - return eval(expr) \ No newline at end of file diff --git a/.github/workflows/test_calculator.py b/.github/workflows/test_calculator.py deleted file mode 100644 index 7cb79e9..0000000 --- a/.github/workflows/test_calculator.py +++ /dev/null @@ -1,33 +0,0 @@ -import unittest -from calculator import Calculator - -class TestCalculator(unittest.TestCase): - # base test cases - def setUp(self): - self.calc = Calculator() - - def test_add(self): - self.assertEqual(self.calc.add(2, 3), 5) - - def test_sub(self): - self.assertEqual(self.calc.subtract(2, 3), -1) - - def test_multiply(self): - self.assertEqual(self.calc.multiply(2, 3), 6) - - def test_divide(self): - self.assertEqual(self.calc.divide(2, 4), 0.5) - - def test_divide(self): - self.assertEqual(self.calc.divide(4, -2), -2) - - def test_divide_fail(self): # this will fail - self.assertNotEqual(self.calc.divide(4, -2), 2) - - def test_divide_by_zero(self): - with self.assertRaises(ValueError): - self.calc.divide(5, 0) - -# Optional: this allows running the script directly - if __name__ == '__main__': - unittest.main() # diff --git a/__pycache__/calculator.cpython-313.pyc b/__pycache__/calculator.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..718ccaf01120e34e66e5515a309b721c18e27f68 GIT binary patch literal 3197 zcmb_eO>7fa5T3WYc4Ei*H37u$CN%}8B_NR>NP!lSRQx4KUJL|VENgp{EOplI+jT+^ z2-HIrT2*=0E|3od!;=aGISGxFEx3=mbUF0*cftl+j!q zXJOAX8jOUQ(|C>>;~6tEsoUI0Cd-&IXO%(mAa>>;4xA~#1%+`@5w-xAXk+eCB;;Pj zgS<}hBCl8Kko%N+?jQGs{f_^*mQLomxgp zjbG5rl+MrOEL%>-l_7Q2w0LsG%I@rpQ?IIqY1pdj1XnTLuF#9xtOjJaVQE9hgR`^J z7rr76AxWmWv~o5I;T&9S+ly@o9fZwecr0>~J4|y}!lHGuEOXk_5w%pxXy%CA z(zcOJ&#Y7C3Y%*yBlpl(N%bgZ;lM=z4c)bxGK$b!Nfn);vvDp2VR3|09A35z8dHX4 zWK20RBVX5f22;m>UQ6fnACK77c;B?DM{*wr%A!b7@UqHvcEaUZ3Zr8$VQ$VzUzAi!IU2dS(xnIc9ZvUZmWFhWi2*5dpK6}kNcfH$&DpfBCZXJo> z>r_oKvadvn$6e{R_;h$jp3(K>A!O^0Mc45Fenpyj3j;t0!z92dIGssqY3nF< zw8=zDqmC$ zCvGlG-24;Z7CR~6+$rILfED)^yGV_}MoEYZN_C3wKxNn4PMYXHBPEk#b&KBqaH~_t z^=w*8>YQpR$7>7xZDM33-$N`+tc%z?#OUXWQ{{F9uA`4~2}h#9IIWkkinvv!Ttvug zj&JB%QqS6?&QmV&5?SE*$dM$*TV-mKIzNPHi_#Jczx+YPw{FbWRY+I3iB{~yq(o0H zHV41Fap%Uv~U$AQAeo_tHsQuAh#^_OJ5g^hjr zmcC^X1urcsGEZ9lgWKTAwyq(s7-pq-kAxfO&yKv0e|COVoy??iY3c`5_2ZnDuFN#6 z>X^YTJ8hV{nNd|v`*FHloSt+}FEf{k4Iy*dRn@XJ+eoUKjen(yoUL29sD%Jjz)GRz z6zLM9yJ*SCK85EJ^MsyznWud%6Fu#J`8Rp`%Zq7USmH;paXRRyxAMC_Q?b5#jm$`v sevZq!*6Vlb50_7Sln>)p^s-s)$k1bq{R+O{;Jv@4F4q4Xkd-w53vP*t3jhEB literal 0 HcmV?d00001 diff --git a/__pycache__/exceptions.cpython-313.pyc b/__pycache__/exceptions.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..30b353dbd7abd89dd9e8708af84f64cba56265fb GIT binary patch literal 1162 zcmbVL!EO^V5cMXTG-)XXRaAwO#jOb1Ln#snA+<>mNL7(oA*5<0%iVQSi_LBrdrO-S z;M_|kexW!1fHR-KUO90?O1LxQB-@;Ns1M`W_r~Kl0a{q9fw!(;3>eau#E z>Wo5kF4#JI$O86&1zyN@suK=8hgJ}+hF*zQ9O@%ln?tJ(ts}ZHhx)z7Ml+h-NjvIr zYqXBr1q&H?0fS25K{cp=A5@{%^EYb6N=qhDo=BTP2Oxt#ba1$_CynA!B8}nQ40u!q zJpqNmD&~r!&E_RLxU3fqAyU~_LKKTa^s_im$iF4T=UgUJW<`ju24fSQsx(7-L5Mhu z(77jsvC`^DNNYhKMS*zgEOF(J40of2AZ$zm%m;34OpI0H|pcs+w?>xI_{hf zKpBJgP1;$S94sy#?8Oyan%q7@#bsqp7bnZmhZTh@3Genl^ zpOxx~zmfXYwm#7$dhhH|K{k=TgxQ9V=B3BeD1LOthZsk)@yS$wfD>_@@Kq8{hH{p| zpO(Ujx{>gucGj1A+G{F*_(bf2*G7jVl$ed9KF{ VxA7vHZ(`2hy7JGr{!xre`yUdY41E9q literal 0 HcmV?d00001 diff --git a/__pycache__/test_calculator.cpython-313.pyc b/__pycache__/test_calculator.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..de892082e1e7d48ad4ff73417bff211a03602625 GIT binary patch literal 2805 zcmd5;-A^M`6u@tBF>GQmU`*J@;uC*>|A3E8#geNgCO-9T0~!+_)N`gCTDq|MMD{lQ&6#uV*ZJLZ z&zWOc4iad$1K(TU3WWTIFJAN2gyS0^Y!Q{H+$}=!$=~AM;VB;_JtR(4p_izlMv{JS zVEs7`b7G_73a9ugC?*t+1#cReR6b)kIhsP9*Z7)n{4oeyL?e__3FTFe3M$_Vv*23P zr;31n)dv_*{eY4ha8UwmQCk3m8c~CjcL*`M2+>-TJ>C-aXPk`JUZO;8rSeLsii*tI z-ZO2dzQ>9P9aCI=D8Y@QYsYbbEpqq7=1sXsGAFtfqHqa?r#OI#DR6y{W1?+lmTl}4 zW$)gc)D~@%+S>HnA5PC}x3lI9weFePjA?)5@1c(t66*N?EwF(YZ1lDTUK!!8Bo;Na70v!{K zbegt+R3(g}159#V2Mc??$y3kZj)+0u2jox+m8G7d)U(~S8{P@;Ms^~P)(f#xc%)z) zNTak3dYwAqi==>d!0Pl8K;<83ia`F7(n7rGq9S^IM!Nb;|T_2_npv?DJZt;^}h6C1@4J*S2&p&0i16I98Uiyks-}cPz+|FFNf27zyQdrpMOZ~6z zFC0kMpAz(6!!+krfx9O)V7yi%coM~mA;O@hmJBp0;I*+fKpl2}jTItBM##&xVQE-l znU9h|SOG)i4PlTha|#3s#x%v9C?X402~8T7ZQ3mOzLCkBvy|qjn^4cDwzHAir49YQ zNpmdz6n1NU`d~?W6aX@;e5ouC6y0p3Ky1r^ySzT8+cb5sJ4Ru*#)zozs1Zysx&!8OAb*zgu zOS`TwThw+kR@Thsbe&?#r+6J`FTx;#drgK=x(2|ceAaT%Unb(3tXtP@$8fBaZa5CL zmhxcJ^*!PSgj;GU7G@XlQ0*H4pO7Pw^Tm$*oNo-_I>N+hcBJIDB*zaP5>v?#m+>P{wB#AY&>+I)f&o-%5reCLr%KNa|LUvsFxJacWU< zjH6qWqfd-~UaCt`W?5>COKNd;Nq#|0cw$~kYLQQAafw25Ot5Rbb7D?%X-;BEeo;(G zQD%C6UVd(BNl|5dZhlH>PHIeid}dx|NqoFsLFFwD8;GD?5i8ItkW-35jE~HWjEqIh GKo$V6*)lKy literal 0 HcmV?d00001 diff --git a/trigonometry_module/__pycache__/trigonometric.cpython-313.pyc b/trigonometry_module/__pycache__/trigonometric.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b6114f5809fb64be13a7b149a1151d2b4d790a36 GIT binary patch literal 2863 zcmd5;&2Jl35P#3!jW_=2lF(FEfZ{j~uub|AL|Z8!MAQVeGzyT#Lc&I?#oi<&B zjS|!YCsd^eDnX>sRB9zSH2(?QjC?^$IdRGj#X=lmX4hNWu}wGtWe&f6`)2mNnc3gW zd(BiT&QN|h`MvpFl(ApvB^04GXwKkZhp9~E*BQ_=a-F{wfk=j>S(d5Mai$6vBY`zU z*SI1c(95#Iy~KiD)lF*=z=l#_5g>29G~dC&4l6R?Duam1A*x2k83?p2h^l}%q>6|! zbqG;XV~E45gcw(c5ff@0F{vgHQ)&`UtfiC_Ug|wC*KEtK8ZMZn1B#{8a?#&eM8tqu z^9_U@RzM77rPHc4mt_UA_a)CSwtNqtIkwN2m8d6Fb$8v1fnGLs%kjk3imki*5l?W8 z%BsgV9a=e)@w6**#k^yHQ=EVEgZZW6+m^8a<|jsR!Eioy?TzC5x>Yt{sphzuQc+#h zuIQCgt)ja&6fu}Esx7T*munTHbIvTC+t~8ruC0Y$q`UHPuB{nDXPhyF&)6gR=`U_> z-@Lc@U}EoTL!PQjQ%#Dsf5Mhfb9}<`Y~^vvXstl{B@ZOjDNz{4hZl8B3!cIeBoSH} z1DPgHl76H+9JHp-n&SvT9GlylyTX0>YxyB>q|Y?u>AExxqo{ro!IW%gKrrb(!Jst- z4W|g6l*_I@DF4s&aT%@se{+n>ckxrCOjz@*O#_SPxyt7-+Ak?JX1aO^o1$X9nCXZQi;JNK~F8kaMo}B>o_>RmvtNtkLiUUwggE>>-o|q zc1W-AnZu(CO%%Z=PZ$tYn@_8rs9r+jo~Y2AlIIY#+qTb*Z;glZ->f&DJ>QTo)TIl( zG5@0nURTc+kksn~!kF$82ANZFG~1`o*7nxDvE3Vc>4u!GOWFU_d!))B@6Y$~p3HMN z4`&H_sP!+V8UOwuM_=yaD4D<5<>)?M$z)H`G)u1 1: + raise DomainError("asin domain is [-1, 1]") + return math.degrees(math.asin(x)) def acos(self, x): - return math.degrees(math.acos(float(x))) + x = float(x) + if x < -1 or x > 1: + raise DomainError("acos domain is [-1, 1]") + return math.degrees(math.acos(x)) def atan(self, x): return math.degrees(math.atan(float(x))) From 5c6f262015d1f730e6774fe5b653fd71b8614fc5 Mon Sep 17 00:00:00 2001 From: Shubhayu Sarkar <66989335+Shubhayu2004@users.noreply.github.com> Date: Sun, 29 Mar 2026 20:34:31 +0530 Subject: [PATCH 3/6] Initialize README with project details and instructions Added detailed project description, features, tech stack, and instructions for running the SE Calculator. --- README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e1084ea --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +🧮 SE Calculator + +A simple and efficient Scientific/Software Engineering Calculator built to perform a variety of mathematical and logical operations. This project is designed to demonstrate core programming concepts, modular design, and user interaction. + +🚀 Features +Basic arithmetic operations +Addition, Subtraction, Multiplication, Division +Advanced calculations (if implemented, adjust accordingly) +Power, Square Root, Logarithms +User-friendly interface (CLI/GUI depending on your project) +Error handling (e.g., division by zero) +Modular and clean code structure +🛠️ Tech Stack +Language: C / C++ / Python (update accordingly) +Concepts Used: +Functions / Modular Programming +Conditional Statements +Loops +Input/Output Handling +📂 Project Structure +SE_Calculator/ +│── src/ # Source code files +│── include/ # Header files (if any) +│── main.* # Entry point +│── README.md # Documentation + +(Modify structure based on your repo) + +▶️ How to Run +🔹 Clone the Repository +git clone https://github.com/Shubhayu2004/SE_Calculator.git +cd SE_Calculator +🔹 Compile (if C/C++) +gcc main.c -o calculator +./calculator +🔹 Run (if Python) +python main.py +📸 Sample Output +Enter first number: 10 +Enter operator (+, -, *, /): * +Enter second number: 5 + +Result: 50 +🎯 Purpose + +This project was built to: + +Strengthen programming fundamentals +Understand structured code design +Practice problem-solving and logic building +🔮 Future Improvements +GUI-based calculator (Tkinter / Qt) +Scientific calculator functions +History tracking +Better UI/UX +🤝 Contributing + +Contributions are welcome! +Feel free to fork the repo and submit a pull request. From f5b0098243f242a1f23e1c7568091550072bf3fb Mon Sep 17 00:00:00 2001 From: Aratrika Gupta <157571977+Aratrika-Gupta@users.noreply.github.com> Date: Sun, 29 Mar 2026 22:37:13 +0530 Subject: [PATCH 4/6] Add files via upload --- trigonometry_module/trigonometric.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/trigonometry_module/trigonometric.py b/trigonometry_module/trigonometric.py index 4db1fdf..7143cb3 100644 --- a/trigonometry_module/trigonometric.py +++ b/trigonometry_module/trigonometric.py @@ -13,20 +13,33 @@ def cos(self, x): return math.cos(self.to_radians(x)) def tan(self, x): + x = float(x) + + # tan is undefined at 90 + k*180 + if x % 180 == 90: + raise ValueError("tan undefined at 90 + k*180") + return math.tan(self.to_radians(x)) - def asin(self, x): + def asin_domain(self, x): x = float(x) if x < -1 or x > 1: - raise DomainError("asin domain is [-1, 1]") + raise ValueError("asin domain is [-1,1]") return math.degrees(math.asin(x)) - def acos(self, x): + def acos_domain(self, x): x = float(x) if x < -1 or x > 1: - raise DomainError("acos domain is [-1, 1]") + raise ValueError("acos domain is [-1,1]") return math.degrees(math.acos(x)) + + def asin_value(self, x): + return math.degrees(math.asin(float(x))) + + def acos_value(self, x): + return math.degrees(math.acos(float(x))) + def atan(self, x): return math.degrees(math.atan(float(x))) @@ -37,4 +50,5 @@ def cosh(self, x): return math.cosh(float(x)) def tanh(self, x): - return math.tanh(float(x)) \ No newline at end of file + return math.tanh(float(x)) + \ No newline at end of file From 3f0766a449f52818e863ebeb741bc73ac9aa5a7d Mon Sep 17 00:00:00 2001 From: Aratrika Gupta <157571977+Aratrika-Gupta@users.noreply.github.com> Date: Sun, 29 Mar 2026 22:41:43 +0530 Subject: [PATCH 5/6] Add files via upload --- trigonometry_module/test_trigonometric.py | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/trigonometry_module/test_trigonometric.py b/trigonometry_module/test_trigonometric.py index 547389c..1fe72e0 100644 --- a/trigonometry_module/test_trigonometric.py +++ b/trigonometry_module/test_trigonometric.py @@ -23,6 +23,34 @@ def test_inverse(self): def test_hyperbolic(self): self.assertAlmostEqual(self.calc.evaluate("sinh(0)"), 0.0, places=2) + + #more test cases: + def test_sin_zero(self): + self.assertAlmostEqual(self.calc.evaluate("sin(0)"), 0.0, places=2) + + def test_cos_zero(self): + self.assertAlmostEqual(self.calc.evaluate("cos(0)"), 1.0, places=2) + + def test_tan_zero(self): + self.assertAlmostEqual(self.calc.evaluate("tan(0)"), 0.0, places=2) + + def test_asin_one(self): + self.assertAlmostEqual(self.calc.evaluate("asin(1)"), 90.0, places=2) + + def test_acos_one(self): + self.assertAlmostEqual(self.calc.evaluate("acos(1)"), 0.0, places=2) + + def test_expression_mix(self): + self.assertAlmostEqual(self.calc.evaluate("5 + 2*cos(60)"), 6.0, places=2) + + + def test_invalid_expression(self): + with self.assertRaises(ValueError): + self.calc.evaluate("sin()") + + def test_invalid_function(self): + with self.assertRaises(ValueError): + self.calc.evaluate("sinn(30)") def test_division_by_zero(self): with self.assertRaises(DivisionByZeroError): From d62325d22b80edc8bc24fcc186466fabf381602a Mon Sep 17 00:00:00 2001 From: Aratrika Gupta <157571977+Aratrika-Gupta@users.noreply.github.com> Date: Sun, 29 Mar 2026 22:43:08 +0530 Subject: [PATCH 6/6] Clean up README.md content Removed project description and features from README. --- README.md | 58 ------------------------------------------------------- 1 file changed, 58 deletions(-) diff --git a/README.md b/README.md index e1084ea..24c5e68 100644 --- a/README.md +++ b/README.md @@ -1,59 +1 @@ -🧮 SE Calculator - A simple and efficient Scientific/Software Engineering Calculator built to perform a variety of mathematical and logical operations. This project is designed to demonstrate core programming concepts, modular design, and user interaction. - -🚀 Features -Basic arithmetic operations -Addition, Subtraction, Multiplication, Division -Advanced calculations (if implemented, adjust accordingly) -Power, Square Root, Logarithms -User-friendly interface (CLI/GUI depending on your project) -Error handling (e.g., division by zero) -Modular and clean code structure -🛠️ Tech Stack -Language: C / C++ / Python (update accordingly) -Concepts Used: -Functions / Modular Programming -Conditional Statements -Loops -Input/Output Handling -📂 Project Structure -SE_Calculator/ -│── src/ # Source code files -│── include/ # Header files (if any) -│── main.* # Entry point -│── README.md # Documentation - -(Modify structure based on your repo) - -▶️ How to Run -🔹 Clone the Repository -git clone https://github.com/Shubhayu2004/SE_Calculator.git -cd SE_Calculator -🔹 Compile (if C/C++) -gcc main.c -o calculator -./calculator -🔹 Run (if Python) -python main.py -📸 Sample Output -Enter first number: 10 -Enter operator (+, -, *, /): * -Enter second number: 5 - -Result: 50 -🎯 Purpose - -This project was built to: - -Strengthen programming fundamentals -Understand structured code design -Practice problem-solving and logic building -🔮 Future Improvements -GUI-based calculator (Tkinter / Qt) -Scientific calculator functions -History tracking -Better UI/UX -🤝 Contributing - -Contributions are welcome! -Feel free to fork the repo and submit a pull request.