Ask your own question, for FREE!
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW) 8 Online
OpenStudy (anonymous):

Am working on ex. 2.3 from hw2.pdf. I'm trying to use math.ceil(276/19) but it returns 14 not 15. I'm running Python 2.7.2. I thought math.ceil() was supposed to round floats up not down.

OpenStudy (rsmith6559):

Floats yes, you're giving it an integer. If given two integers in division, Python will do integer division. If one or both of the numbers is a float, you'll get what you're expecting.

OpenStudy (anonymous):

Thanks for the info. Sometimes it's just sitting in front of your face. I even read the Python docs on it and it still didn't click. Thanks again.

OpenStudy (rsmith6559):

You're welcome.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!