Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86edb1c3dd | ||
|
|
438b89a1df | ||
|
|
6adb96248a |
@@ -1,33 +0,0 @@
|
|||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+10
-14
@@ -1,21 +1,17 @@
|
|||||||
|
# User agreement
|
||||||
|
|
||||||
# How to use calculator:
|
Please check out License Agreement for personal usage terms and limitations
|
||||||
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
|
# Math formulas
|
||||||
## Area
|
## Area
|
||||||
- Circle: `S = πR²`
|
- Circle: S = πR²
|
||||||
- Rectangle: `S = ab`
|
- Rectangle: S = ab
|
||||||
- Square: `S = a²`
|
- Square: S = a²
|
||||||
- Triangle: `S = sqrt(p * (p-a) * (p-b) * (p-c))` where p is semiperimeter
|
|
||||||
|
|
||||||
## Perimeter
|
## Perimeter
|
||||||
- Circle: `P = 2πR`
|
- Circle: P = 2πR
|
||||||
- Rectangle: `P = 2a + 2b`
|
- Rectangle: P = 2a + 2b
|
||||||
- Square: `P = 4a`
|
- Square: P = 4a
|
||||||
- Triangle: `P = a + b + c`
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
def area(a, b, c):
|
|
||||||
return (a + b + c) / 2
|
|
||||||
|
|
||||||
|
|
||||||
def perimeter(a, b, c):
|
|
||||||
return a + b + c
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
License Agreement
|
||||||
|
|
||||||
|
This License Agreement is made and effective as of 10 march 2021 by and between Smartiqa Group, a company organized and existing in Russian Federation, with a registered address at Moscow and User, a company organized and existing in Russian Federation, with a registered address at Moscow.
|
||||||
|
|
||||||
|
1.1 “Agreement” means this License Agreement including the attached Schedule.
|
||||||
|
|
||||||
|
1.2 “Confidential Information” means information that:
|
||||||
|
a. is by its nature confidential;
|
||||||
|
b. is designated in writing by Licensor as confidential;
|
||||||
|
c. the Licensee knows or reasonably ought to know is confidential;
|
||||||
|
d. Information comprised in or relating to any Intellectual Property Rights of Licensor.
|
||||||
|
|
||||||
|
1.3 “Asset” means the Asset provided by Licensor as specified in Item 6 of the Schedule in the form as stated in Item 7 of the Schedule.
|
||||||
|
|
||||||
Reference in New Issue
Block a user