I'm learning via Learn Python The Hard Way and I've come across:
Notice the math seems “wrong”? There are no fractions, only whole numbers. Find out why by researching what a “floating point” number is.
I've read what it is on: http://docs.python.org/tutorial/floatingpoint.html
I can't figure out on how I can output floating point numbers, I've thought about using round(3 + 3, 2)
.
Is this right?
For floating point numbers you write a period after the number, and a zero (if it's a whole number).
Like this:
1.0 <---- Floating point.
1 <------- integer
That is how python interprets them.
if my_answer != your_question:
print "I did not understand your question. Please rephrase it."
else:
print "Good luck. Python is fun."
I agree with rohit, the 0 is not needed. Although it makes things easier for beginners.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With