Here is the code for a python program that determines whether the roots of a quadratic equation are real or imaginary. If the roots are real, the program will print the value of the roots.
# Python program to determine the roots of a quadratic equation
a = int(input('Enter the coefficient of x2: '))
b = int(input('Enter the coefficient of x: '))
c = int(input('Enter the value of constant: '))
disc = b ** 2 - (4 * a * c)
roots1 = (-b + ( b ** 2 - (4 * a * c) )**(1/2)) / (2*a)
roots2 = (-b - ( b ** 2 - (4 * a * c) )**(1/2)) / (2*a)
if disc >= 0:
print('Roots are real.')
print(roots1)
print(roots2)
else:
print('Roots are imaginary.')
# This code is contributed by Ahmad Shafiq