Skip to content

Commit db93362

Browse files
Merge pull request #1 from TheAlgorithms/master
Rebasing
2 parents e9865ae + b934da4 commit db93362

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

Diff for: .github/workflows/auto_close_empty_issues.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# GitHub Action that uses close-issue auto-close empty issues after they are opened.
2+
# If the issue body text is empty the Action auto-closes it and sends a notification.
3+
# Otherwise if the issue body is not empty, it does nothing and the issue remains open.
4+
# https://github.com/marketplace/actions/close-issue
5+
6+
name: auto_close_empty_issues
7+
on:
8+
issues:
9+
types: [opened]
10+
jobs:
11+
check-issue-body-not-empty:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- if: github.event.issue.body == 0
15+
name: Close Issue
16+
uses: peter-evans/close-issue@v1
17+
with:
18+
comment: |
19+
Issue body must contain content.
20+
Auto-closing this issue.

Diff for: DIRECTORY.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,8 @@
547547
* Problem 11
548548
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_11/sol1.py)
549549
* [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_11/sol2.py)
550+
* Problem 112
551+
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_112/sol1.py)
550552
* Problem 12
551553
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_12/sol1.py)
552554
* [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_12/sol2.py)
@@ -691,7 +693,6 @@
691693
* [External Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/external_sort.py)
692694
* [Gnome Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/gnome_sort.py)
693695
* [Heap Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/heap_sort.py)
694-
* [I Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/i_sort.py)
695696
* [Insertion Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/insertion_sort.py)
696697
* [Iterative Merge Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/iterative_merge_sort.py)
697698
* [Merge Insertion Sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/merge_insertion_sort.py)

Diff for: maths/area.py

+25
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,30 @@ def area_circle(radius: float) -> float:
186186
return pi * radius ** 2
187187

188188

189+
def area_rhombus(diagonal_1: float, diagonal_2: float) -> float:
190+
"""
191+
Calculate the area of a rhombus
192+
193+
>>> area_rhombus(10, 20)
194+
100.0
195+
>>> area_rhombus(-1, -2)
196+
Traceback (most recent call last):
197+
...
198+
ValueError: area_rhombus() only accepts non-negative values
199+
>>> area_rhombus(1, -2)
200+
Traceback (most recent call last):
201+
...
202+
ValueError: area_rhombus() only accepts non-negative values
203+
>>> area_rhombus(-1, 2)
204+
Traceback (most recent call last):
205+
...
206+
ValueError: area_rhombus() only accepts non-negative values
207+
"""
208+
if diagonal_1 < 0 or diagonal_2 < 0:
209+
raise ValueError("area_rhombus() only accepts non-negative values")
210+
return 1 / 2 * diagonal_1 * diagonal_2
211+
212+
189213
def main():
190214
print("Areas of various geometric shapes: \n")
191215
print(f"Rectangle: {area_rectangle(10, 20)}")
@@ -197,6 +221,7 @@ def main():
197221
print("\nSurface Areas of various geometric shapes: \n")
198222
print(f"Cube: {surface_area_cube(20)}")
199223
print(f"Sphere: {surface_area_sphere(20)}")
224+
print(f"Rhombus: {area_rhombus(10, 20)}")
200225

201226

202227
if __name__ == "__main__":

0 commit comments

Comments
 (0)