What's the different between ceil & floor in python?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

What's the different between ceil & floor in python??

Ceil & floor functions are like same! I couldn't understand yet!

26th Aug 2017, 1:57 AM
Shadow Windster
Shadow Windster - avatar
2 Answers
+ 18
Ceil rounds off a floating point value to its upper limit, e.g. 4.56 -> 5. Floor rounds off a floating point value to its lower limit, e.g. 3.67 -> 3.
26th Aug 2017, 2:00 AM
Hatsy Rei
Hatsy Rei - avatar
+ 9
how to remember: ->imagine your home "ceil" is roof of your home (take highest decimal number) and "floor" is floor of your home(take lowest decimal number) ->take example 1) ceil and floor of 3.01 ceil->4(highest decimal number) floor->3(lowest decimal number) 2)ceil and floor of 4.99 ceil->5(highest decimal number) floor->4(lowest decimal number) i hope you understand this........
26th Aug 2017, 2:26 AM
SUJITH
SUJITH - avatar