Python Forum
unexpected output - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: unexpected output (/thread-3245.html)



unexpected output - Alberto - May-08-2017

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?


RE: General Help - Larz60+ - May-08-2017

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)



RE: unexpected output - Alberto - May-08-2017

Thank you!