English

How is math.ceil(89.7) different from math.floor (89.7)? - Computer Science (Python)

Advertisements
Advertisements

Question

How is math.ceil(89.7) different from math.floor (89.7)?

Short/Brief Note
Advertisements

Solution

Floor: The function 'floor(x)' in Python returns the largest integer not greater than x. i.e. the integer part from the variable.

Ceil: The function 'ceil(x)' in Python returns the smallest integer not less than x i.e., the next integer on the RHS of the number line.

Hence, 'math.ceil(89.7)' will return 90 whereas 'math.floor(89.7)' will return 89.

shaalaa.com
  Is there an error in this question or solution?
Chapter 7: Functions - Exercise [Page 170]

APPEARS IN

NCERT Computer Science [English] Class 11
Chapter 7 Functions
Exercise | Q 2. | Page 170
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×