Skip to content

Commit 90db979

Browse files
authored
Create equations.py
1 parent d67aff1 commit 90db979

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

equations.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
###
2+
#####
3+
####### by @JymPatel
4+
#####
5+
###
6+
7+
###
8+
##### edited by ... (editors can put their name and thanks for suggestion) :)
9+
###
10+
11+
12+
# what we are going to do
13+
print("We can solve the below equations")
14+
print("1 Quadratic Equation")
15+
16+
# ask what they want to solve
17+
sinput = input("What you would like to solve?")
18+
19+
# for Qdc Eqn
20+
if sinput == '1':
21+
print("We will solve for equation 'a(x^2) + b(x) + c'")
22+
23+
# value of a
24+
a = int(input("What is value of a?"))
25+
b = int(input("What is value of b?"))
26+
c = int(input("What is value of c?"))
27+
28+
D = b**2 - 4*a*c
29+
30+
if D < 0:
31+
print("No real values of x satisfies your equation.")
32+
33+
else:
34+
x1 = (-b + D)/(2*a)
35+
x2 = (-b - D)/(2*a)
36+
37+
print("Roots for your equation are" , x1, "&", x2)
38+
39+
40+
else:
41+
print("You have selected wrong option.")
42+
print("Select integer for your equation and run this code again")
43+
44+
45+
46+
47+
# end of code
48+
print("You can visit https://github.com/JymPatel/Python3-FirstEdition")
49+
50+
# get NEW versions of equations.py at https://github.com/JymPatel/Python3-FirstEdition with more equations
51+
# EVEN YOU CAN CONTRIBUTE THEIR. EVERYONE IS WELCOMED THERE..

0 commit comments

Comments
 (0)