"""
Recommended Python Style Guide:
https://peps.python.org/pep-0008/#introduction
"""

import math

print("Enter the coefficients of the quadratic function ax^2 + bx + c")
# Prompts the user for entering the coefficient like 'a = ', gets the user inputs, and converts them to float
a = float(input("a = "))
b = float(input("b = "))
c = float(input("c = "))

# If a != 0, perform the computations for delta
if a != 0:
    delta = b**2 - 4 * a * c

    # If delta < 0, there is no solution
    if delta < 0:
        """
        The following line prints "delta: " and the delta.
        The '+' operator concatenates the strings.
        str(delta) converts the float value of delta to a string.
        Alternatively, you can use:
        * print("delta: ", str(delta))
        * print(f"delta: {delta}")
        To limit the number of digits after the decimal point to two, use:
        * print(f"delta: {delta:.2f}")
        """
        print("delta: " + str(delta))
        print("This equation has no solution.")

    # If delta == 0, there is 1 solution
    elif delta == 0:
        x = -b / (2 * a)
        print(f"delta: {delta}")
        print(f"x: {x}")

    # If delta > 0, there are 2 solutions
    else:
        square_root_delta = math.sqrt(delta)
        x1 = (-b - square_root_delta) / (2 * a)
        x2 = (-b + square_root_delta) / (2 * a)
        print(f"delta: {delta}")
        print(f"x1: {x1}")
        print(f"x2: {x2}")

# If a == 0, handle it as a linear equation
else:
    if b != 0:
        # True division
        x = -c / b
        print(f"x = {x}")
    else:
        # In the following line, (if c != 0)  can be written as (if c), as both return the same answer for any c
        if c != 0:
            print("This equation has no solution.")
        else:
            print("Every real number is a solution of this equation.")

