File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 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..
You can’t perform that action at this time.
0 commit comments