In this number manipulation post, Let’s see how to manipulate or round any numbers. And also we will be seeing some examples related to number manipulation. Below is the video format of the post, check it out ????????
What is number manipulation ❓
Good question, Number manipulation is manipulating numbers. Let me tell it in an example format.
There is a value like 2.35678 and we are going to manipulate and display on the whole number or we just display the next two digits of the decimal point.
Now, you will be having an idea of what is number manipulation is… If yes comment down below.
Number manipulation in python ????
So, below is a code that is in the float data type and I want to make this value in the form of a whole number and also let’s round the number and specify how many decimal points we need.
Firstly let’s manipulate the number using the round () function,
If I add the round function it has rounded the value to 1 and this is how the round function works and if you want to specify how many digits you need to add at the back. Just enter the below code.
In the place of 2, you could specify how many decimal points you need.
Just keep on trying with your IDE or any online compilers.
Using floor division in python still, you could manipulate numbers in python.
// : Floor divison
While doing a normal division you will get the value in float format but if you do a floor division, you will probably get the value in int format.
In this video, I have taught you how to manipulate numbers in python and I have shared two ways to manipulate them they are round function and floor division.
Also Read: Operations in python
Also Read: BMI calculator in python