{"id":24067,"date":"2021-10-14T09:12:47","date_gmt":"2021-10-14T03:42:47","guid":{"rendered":"https:\/\/python-programs.com\/?p=24067"},"modified":"2021-11-05T20:56:43","modified_gmt":"2021-11-05T15:26:43","slug":"python-program-for-ceil-function","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-for-ceil-function\/","title":{"rendered":"Python Program for ceil() Function"},"content":{"rendered":"

In the previous article, we have discussed Python Program for Set discard() Method<\/a>
\nceil() Function in Python:<\/strong><\/p>\n

If necessary, the math.ceil() method rounds a number UP<\/strong> to the nearest integer and returns the result.<\/p>\n

The ceil function in Python is used to return the smallest integer value that is greater than or equal to the specified expression or number.<\/p>\n

Syntax:<\/strong><\/p>\n

math.ceil(number)<\/pre>\n

Parameter Values:<\/strong><\/p>\n

number: This is required. It Sets the number to round up.<\/p>\n

Note:<\/strong> The ceil function returns the ceiling value if the number argument is positive or negative.
\nThe math ceil function returns TypeError if the number argument is not a number.<\/p>\n

Return Value: <\/strong>The return value is an int value that represents the rounded number.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given tuple = (1.3, 10.04, -4.4, 7.7, 9.45)\r\nGiven List = [2.8, 3.4, -1.7, -6.82, 12.2]<\/pre>\n

Output:<\/strong><\/p>\n

Given positive number 9.2 ceiling value = 10.00\r\nGiven negative number -8.6 ceiling value = -8.00\r\nGiven Tuple element(gvn_tupl[3]) ceiling value = 8.00\r\nGiven Tuple element(gvn_lst[2]) ceiling value = -1.00\r\nThe Ceil of pi is:  4\r\nGiven multiple number(35+40-10.3) ceiling value  = 65.00<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given tuple = (2.4, 85.67, 37.8, -25.5)\r\nGiven List =  [45.9, 11.32, -25, 6, 12.8, -10]<\/pre>\n

Output:<\/strong><\/p>\n

Given positive number 30.1 ceiling value = 31.00\r\nGiven negative number -20.4 ceiling value = -20.00\r\nGiven Tuple element(gvn_tupl[0]) ceiling value = 3.00\r\nGiven Tuple element(gvn_lst[3]) ceiling value = 6.00\r\nThe Ceil of pi is:  4\r\nGiven multiple number (23-10+5) ceiling value  = 18.00<\/pre>\n

Program for ceil() Function in Python<\/h2>\n