Python Forum

Full Version: unexpected output
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dear Python Experts,

I am pretty new to programming, thus please help me with the following code:


import math

def quadratic_formula(a, b, c):
    ans1 = (-1 * b + math.sqrt(b ** 2 - 4 * a * c)) / (2 * a)
    ans2 = (-1 * b - math.sqrt(b ** 2 - 4 * a * c)) / (2 * a)
    print ("Answers are %.2f and %.2f" % (ans1, ans2))
    
    print ("Quadratic Formula Program")
    a = int(input("Please input a: "))
    b = int(input("Please input b: "))
    c = int(input("Please input c: "))
    quadratic_formula(a,b,c)
However, when I run it there is nothing appeared on console. Please, can you tell me where is my mistake?
You never run the code!

remove indentation from :
print ("Quadratic Formula Program")
a = int(input("Please input a: "))
b = int(input("Please input b: "))
c = int(input("Please input c: "))
quadratic_formula(a,b,c)
Thank you!