Numbers are used quite often in programming to keep scoring games, represent data visualization, stored
information in web applications and so on.
So Python threads numbers in several different ways depending on how they are being used.
Let's first look at how Python manages integers because they are the simplest to work with.
Here.
We will do it.
This run again.
Here now.
Firstly, we will start with integers.
Now let's change the color.
Integers.
So you can do math with integers, of course.
Here now.
For example, my integer or my value here, two plus three and print my value.
I see here.
Five two plus nine.
Nine nine.
Doesn't one.
You can do subtraction.
And it's 9.97 multiplication.
And division.
In terminal session.
Python simply returns the results of the operation, and Python uses two multiple action symbols to
represent exponents.
So here this is exponent exponential here.
As you can see here, there's a lot of numbers here.
Go.
You can see here, we can do this.
The second one I show here.
So Python supports the order of operations too, so you can use multiple operations in one expression.
So you can also use parentheses to modify the order of operations so Python can evaluate your expression
in the order you specify, for example, like this.
Uh, two plus two plus nine, multiply by four.
Here it's 44.
And the spacing in these examples has no effect on how Python evaluates the expressions here.
Like this.
This will.
But this has no effect on Python.
But it simply helps you more more quickly spot operations that have priority in your reading throughout
your code.
And we also have lots.
So Python calls any number with a decimal point a float.
This term is used in most programming languages, and it refers to the fact that a decimal point can
appear at any position in a number.
Every programming language must be carefully designed to appropriately manage decimal numbers so numbers
behave appropriately no matter where the decimal point appears.
So for the most part, you can use floats without worrying about how they behave.
Simply enter the number numbers you want to use and the python will most likely do what you expect.
Like this here for example.
0.1 multiply by or.
0.9 here it's 1.0999.
1.099.
And we also have here sample.
Do.
1999 multiply by 0.1.
And 9.9.
However, be aware that you can sometimes get an arbitrary number of decimal places in your answer.
For example, this 0.90.2 here plus 3.1.
And as you can see here, we get this.
So this happens in all languages and this is of little concern.
So Python tries to find a way to represent the results as precisely as possible, which is sometimes
difficult, even how computers have to represent numbers internally.
So just ignore the extra decimal places for now so you will learn ways to deal with the extra places
when you need to in the projects of Part two.
And we also said so when you divide in two numbers, even if they are integers that result in a whole
number.
So you will always get the float here, for example, divide four by two and the 2.0.
So if you mix an integer and a float in any other operation, you will get a float as well.
Look, this oops here, one one plus 5.0.
And as you can see, it's 6.0.
So Python defaults to a float in any operation that use the flow.
So even if the output is a whole number.
We also have underscores in numbers, which you will learn in next lecture.