From 03478a75b444cbb167fa2c38bc58c50af412143c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A8=D1=83=D0=BB=D0=B5=D0=BF=D0=BE=D0=B2=20=D0=95=D0=B3?= =?UTF-8?q?=D0=BE=D1=80=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 26 Feb 2025 15:48:45 +0300 Subject: [PATCH 1/2] Fix merge conflict in README.md L-04: Experimental commit --- calculate.py | 33 +++++++++++++++++++++++++++++++++ docs/README.md | 23 ++++++++++++++++++++--- 2 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 calculate.py diff --git a/calculate.py b/calculate.py new file mode 100644 index 0000000000..6dc22cf124 --- /dev/null +++ b/calculate.py @@ -0,0 +1,33 @@ +import circle +import square + + +figs = ['circle', 'square'] +funcs = ['perimeter', 'area'] +sizes = {} + +def calc(fig, func, size): + assert fig in figs + assert func in funcs + + result = eval(f'{fig}.{func}(*{size})') + print(f'{func} of {fig} is {result}') + +if __name__ == "__main__": + func = '' + fig = '' + size = list() + + while fig not in figs: + fig = input(f"Enter figure name, avaliable are {figs}:\n") + + while func not in funcs: + func = input(f"Enter function name, avaliable are {funcs}:\n") + + while len(size) != sizes.get(f"{func}-{fig}", 1): + size = list(map(int, input("Input figure sizes separated by space, 1 for circle and square\n").split(' '))) + + calc(fig, func, size) + + + diff --git a/docs/README.md b/docs/README.md index 0a951eac28..07c4b05d3b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,12 +1,29 @@ + +# How to use calculator: +1. Run `python calculate.py` +2. Enter the figure name. Available are Circle, Square. +3. Enter the function: Area or Perimeter. +4. Enter figure sizes. Radius for circle, one side for square. +5. Get the answer! + # Math formulas ## Area -- Circle: S = πR² -- Rectangle: S = ab -- Square: S = a² +- Circle: `S = πR²` +- Rectangle: `S = ab` +- Square: `S = a²` +- Triangle: `S = sqrt(p * (p-a) * (p-b) * (p-c))` where p is semiperimeter ## Perimeter +<<<<<<< HEAD - Circle: P = 2πR - Rectangle: P = 2a + 2b - Square: P = 4a # Some change for Lesson 6 practice +======= +- Circle: `P = 2πR` +- Rectangle: `P = 2a + 2b` +- Square: `P = 4a` +- Triangle: `P = a + b + c` + +>>>>>>> 94b208f (L-04: Experimental commit) From 4e7ad62616bfd7ebf2b44baa4f2a502dc66e39cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A8=D1=83=D0=BB=D0=B5=D0=BF=D0=BE=D0=B2=20=D0=95=D0=B3?= =?UTF-8?q?=D0=BE=D1=80=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 26 Feb 2025 15:50:56 +0300 Subject: [PATCH 2/2] L-04: Deleted circle and square --- circle.py | 10 ---------- square.py | 7 ------- 2 files changed, 17 deletions(-) delete mode 100644 circle.py delete mode 100644 square.py diff --git a/circle.py b/circle.py deleted file mode 100644 index c3eb8647c9..0000000000 --- a/circle.py +++ /dev/null @@ -1,10 +0,0 @@ -import math - - -def area(r): - return math.pi * r * r - - -def perimeter(r): - return 2 * math.pi * r - diff --git a/square.py b/square.py deleted file mode 100644 index 0f98724205..0000000000 --- a/square.py +++ /dev/null @@ -1,7 +0,0 @@ - -def area(a): - return a * a - - -def perimeter(a): - return 4 * a