Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: RunUnitTests

on:
push:
branches:
- new_features_465483
workflow_dispatch:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.8]

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Run Unit Tests
run: |
python unit_tests.py
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/geometric_lib.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added __pycache__/circle.cpython-310.pyc
Binary file not shown.
Binary file added __pycache__/rectangle.cpython-310.pyc
Binary file not shown.
Binary file added __pycache__/square.cpython-310.pyc
Binary file not shown.
Binary file added __pycache__/triangle.cpython-310.pyc
Binary file not shown.
Binary file added __pycache__/unit_tests.cpython-310.pyc
Binary file not shown.
21 changes: 21 additions & 0 deletions circle.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
import math




def area(r):
'''
Returns the area of circle with given radius

Parameters:
int r: radius of the circle

Return value:
(int): area of the circle with given radius
'''
return math.pi * r * r


def perimeter(r):
'''
Returns the perimeter of circle with given radius

Parameters:
int r: radius of the circle

Return value:
(int): perimeter of the circle with given radius
'''

return 2 * math.pi * r

141 changes: 135 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,139 @@
# Library description
Geomitric_lib is a library for calculating the area and perimeter of different geometric figures (circles, triangles, rectangles).

---

# Figures

## [Circle](../circle.py)


### Parameters
- **int r**: size of circle radius

### Functions
- `area(r)`: return area of the circle with given radius
**Example:**
```python
from circle import area
print(area(5)) # Output: 78.5398 (assuming π=3.14159)
```
- `perimeter(r)`: return perimeter of the circle with given radius
**Example:**
```python
from circle import perimeter
print(perimeter(5)) # Output: 31.4159 (assuming π=3.14159)
```

---

## [Rectangle](../rectangle.py)

### Parameters
- **int a, b**: size of rectangle sides

### Functions
- `area(a, b)`: return area of the rectangle with given sides
**Example:**
```python
from rectangle import area
print(area(5, 3)) # Output: 15
```
- `perimeter(a, b)`: return perimeter of the rectangle with given sides
**Example:**
```python
from rectangle import perimeter
print(perimeter(5, 3)) # Output: 16
```

---

## [Square](../square.py)


### Parameters
- **int a**: size of square side

### Functions
- `area(a)`: return area of the square with given side
**Example:**
```python
from square import area
print(area(4)) # Output: 16
```
- `perimeter(a)`: return perimeter of the square with given side
**Example:**
```python
from square import perimeter
print(perimeter(4)) # Output: 16
```

---

## [Triangle](../triangle.py)

### Parameters
- **int a, b**: size of triangle sides

### Functions
- `area(a, b)`: return area of the triangle with given sides
**Example:**
```python
from triangle import area
print(area(5, 4)) # Output: 10
```
- `perimeter(a, b)`: return perimeter of the triangle with given sides
**Example:**
```python
from triangle import perimeter
print(perimeter(3, 4)) # Output: 7
```

---

# Math formulas

## Area
- Circle: S = πR²
- Rectangle: S = ab
- Square: S = a²
- Circle: **S = πR²**
- Rectangle: **S = ab**
- Square: **S = a²**
- Triangle: **S = 0.5ab**

## Perimeter
- Circle: P = 2πR
- Rectangle: P = 2a + 2b
- Square: P = 4a
- Circle: **P = 2πR**
- Rectangle: **P = 2a + 2b**
- Square: **P = 4a**
- Triangle: **P = a + b**

---

# History of commits
- [commit 097241088df9202640ce046d79a2bcfcc85983ee](https://github.com/HuntedDuck/geometric_lib/commit/097241088df9202640ce046d79a2bcfcc85983ee)
Author: HuntedDuck <dimka.gaev@gmail.com>
Date: Wed Sep 25 11:57:28 2024 +0300

Изменена функция поиска периметра в файле rectangle.py

- [commit fee75fd0e73cd67d01c80659350d3d5855825d42](https://github.com/HuntedDuck/geometric_lib/commit/fee75fd0e73cd67d01c80659350d3d5855825d42)
Author: HuntedDuck <dimka.gaev@gmail.com>
Date: Wed Sep 25 11:52:25 2024 +0300

Добавлен файл: rectangle.py

- [commit 4bfbe8f29963e637f7aaabcfb2895cfe7362fa24](https://github.com/HuntedDuck/geometric_lib/commit/4bfbe8f29963e637f7aaabcfb2895cfe7362fa24)
Author: HuntedDuck <dimka.gaev@gmail.com>
Date: Wed Sep 25 11:34:21 2024 +0300

Добавлен файл: rectangle.py

- [commit d078c8d9ee6155f3cb0e577d28d337b791de28e2](https://github.com/HuntedDuck/geometric_lib/commit/d078c8d9ee6155f3cb0e577d28d337b791de28e2)
Author: smartiqa <info@smartiqa.ru>
Date: Thu Mar 4 14:55:29 2021 +0300

L-03: Docs added

- [commit 8ba9aeb3cea847b63a91ac378a2a6db758682460](https://github.com/HuntedDuck/geometric_lib/commit/8ba9aeb3cea847b63a91ac378a2a6db758682460)
Author: smartiqa <info@smartiqa.ru>
Date: Thu Mar 4 14:54:08 2021 +0300

L-03: Circle and square added
1 change: 1 addition & 0 deletions h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

25 changes: 25 additions & 0 deletions rectangle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
def area(a, b):
'''
Area of rectangle with given sides

Parameters:
int a,b: sides of the rectangle

Return value:
(int): area of the rectangle with given sides
'''

return a * b

def perimeter(a, b):
'''
Returns the perimeter of rectangle with given sides

Parameters:
int a,b: sides of the rectangle

Return value:
(int): perimeter of rectangle with given sides
'''

return (a + b)*2
18 changes: 18 additions & 0 deletions square.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@

def area(a):
'''
Returns the area of square with given side

Parameters:
int a: side of the square

Return value:
(int): area of the square with given side
'''
return a * a


def perimeter(a):
'''
Returns the perimeter of square with given side

Parameters:
int a: side of the square

Return value:
(int): perimeter of square with given side
'''
return 4 * a
17 changes: 17 additions & 0 deletions triangle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def area(a, b):
return (a * b)/2

def perimeter(a, b):
return (a + b)+(a**2+b**2)**0.5

'''
Area of triangle with given sides

Parameters:
int a,b: sides of the triangle

Return value:
(int): area of the triangle with given sides
'''


Loading