data types except valueerror as errprint(errreturn this function will loop until the user enters valid floating-point number (such as - )and will accept only if allow_zero is true once the get_float(function is definedthe rest of the code is executed we'll look at it in three partsstarting with the user interactionprint("ax\ {superscript twobx " get_float("enter "falseb get_float("enter "truec get_float("enter "truethanks to the get_float(functiongetting the aband factors is simple the boolean second argument says whether is acceptable none none discriminant ( * ( cif discriminant = -( ( )elseif discriminant root math sqrt(discriminantelsediscriminant root cmath sqrt(discriminantx (- root( ax (- root( athe code looks bit different to the formula because we begin by calculating the discriminant if the discriminant is we know that we have one real solution and so we calculate it directly otherwisewe take the real or complex square root of the discriminant and calculate the two roots equation ("{ } \ {superscript two{ } { \ {rightwards arrowx { }"format(abcx if is not noneequation +or { }format( print(equationwe haven' done any fancy formatting since python' defaults for floating-point numbers are fine for this examplebut we have used unicode character names for couple of special characters