Program For Standard Form

def stnfrm(a,b,c):

    one = (b/(2.0*a))
    two = c-((b**2.0)/(4.0*a))
    axis = one/-1.0
    x = -b/(2.0*a)
    y = a*(x**2.0)+(b*x)+c
    print x
    if a == 1:
        print "(x + %f)**2 + (%f)" % (one,two)
    elif a == -1:    
        print "-(x + %f)**2 + (%d)" % (one,two)
    else:
        print "%d(x + %f)**2 + (%f)" % (a,one,two)
    print "Axis of Symmetry is %f" % (axis)
    print "Vertex is (%f,%f)" % (x,y)
    if a < 0:
        print "Vertex is a Maximum"
    else:
        print "Vertex is a Minimun"
stnfrm(2.0,-16.0,31.0)

All you need to do is change the numbers in th stnfrm(?,?,?) at the bottom to deteremine the outcomes.
My first piece of code ive fully written.
I would appreciate some input and ideas going forward.

Edited 2 Years Ago by Tamara_1: error

Comments
nice

It is very nice. I see 2 directions onwards:

  1. Add interaction with the user to get the coefficients (raw_input, etc).
  2. Use the fractions module from standard lib to work with exact rational coefficients.

Just a small remark: use meaningful names for your variables. Do not use things like "one" and "two".
And yes, I know. It is sometimes hard to find a good meaningful name, but believe me in larger programs it pays off. :)

This question has already been answered. Start a new discussion instead.