Skip to content

Commit 18c8f08

Browse files
committed
add quadratic-equation
1 parent 53ad37a commit 18c8f08

3 files changed

Lines changed: 30 additions & 22 deletions

File tree

CHANGELOG.rst

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
[0.1.1]-2023-05-04
5+
-------------------
6+
7+
- Add quadratic-equation
8+
49
[0.1.0]-2023-05-03
510
-------------------
611

@@ -10,25 +15,3 @@ CHANGELOG
1015
- hex-to-digit
1116
- addition-quiz
1217
- palindrome
13-
14-
15-
16-
17-
18-
19-
20-
21-
22-
23-
24-
25-
26-
27-
28-
29-
30-
31-
32-
33-
34-

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ This collection of small Python programs wants to help beginners in this way. De
1313
* hex-to-digit
1414
* addition-quiz
1515
* palindrome
16+
* quadratic-equation

quadratic-equation/main.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
Quadratic Equation
5+
Version: 1.0
6+
Python 3.11
7+
Date created: May 4th, 2023
8+
Date modified: -
9+
"""
10+
11+
import math
12+
13+
14+
def quadratic_formula(a, b, c):
15+
16+
x1 = (-b - math.sqrt(b * b - 4 * a * c)) / (2 * a)
17+
x2 = -b / a - x1
18+
19+
return (x1, x2)
20+
21+
22+
if __name__ == '__main__':
23+
result = quadratic_formula(2, -8, 6)
24+
print(result)

0 commit comments

Comments
 (0)