View Single Post
Old Oct 30th, 2007, 10:36 PM   #11
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,886
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Re: Quadratic Formula in Python

Quote:
And print out the output in a way the user can understand.
Your code needs print statements if you want to see output. Print out all four variables, root1r, root1i, root2r, root2i, in a format you want your user to see.

A useful thing would be to use "format specifiers". I don't want to confuse you, but this code might help, if you feel ambitious enough to understand it:

Essentially, each %s is replaced with the next variable enclosed inside the brackets.

name = "Aaron"
language = "Python"
word = "fun"

print "Hello, my name is: %s. I program in %s and have a lot of %s with it."%( name, language, word )
Sane is offline   Reply With Quote