In this tutorial, we will learn How to round Up A Number we can use the built in function round and truncate which provides the privilege to take a decision on a number of decimal digits or the number of digits that we want to round up.
Round up is a way to get the floor value of what we have which means most of the time round up reference the removal of decimal digits and apply some rules to get the most appropriate digit which could be presented so that it will be easy for further calculations and make it faster.
It is as simple as simply writing round() and in the parameter just providing the digit we want to round up, on Appling some particular set of rules that are pre defined as rules. And to get it done by looking at the example given below.
round( 1.5) 2
Here 1.5 is converted to 2.
there is another way to remove the decimal digits as per our wish and up to the digit we want. To perform the same we use truncate().
The rule for truncate() is given below
Here we can see how we can provide the place where we can round up and can get the floor value of the variable digit given.
Whereas in case of round up the rule says something else that we will see here
|Value||Round Up To||Result|
Here we can easily see there is a slit difference between both values.
To learn more round up visit: Rounding up the given digit using round and truncate built in function in Python.
And to learn more about python Some Basic List Programs-1.
And to learn more about different programming languages visit. beta python programming languages Solutions.