Assignment 2.1
Assignment 2.1
In mathematics there is an equation that is called quadratic. It is usually written
in the form ax2+bx+c=0, where x represents an unknown, and a, b, and c represent known numbers such that a is not equal to 0.
Our goal is to write a program that outputs the solutions of the quadratic equation.
In order to solve the quadratic equation the easiest method is to calculate the discriminant.
If the discriminant is less than zero then the equation does not have real solution.
If the discriminant is equal to zero then the equation has one double real solution.
Finally if the discriminant is greater than zero then the equation has two different real solutions.
that we can calculate using the previous formulas.
So how can we calculate the square root of discriminator? Python has a library that we can use if we include it in the beginning of our code. The library is called math and has many useful functions. One of them is sqrt.
Try the following code
import math
print (math.sqrt(16))
You can view all the functions inside math following the link
Create a new program, test it and upload it using your name and followed by AS2.1 in the programs file name. As an example a programs filename could be Name_Surname_AS2.1.py
For your effort you will be graded and you will have another try if you want to get a better grade. Passing grade is 60%.
So a sample code to start could be :