Hello and welcome to this video.
The pied ton no data types are used.
Basically if you want to work with numbers in a python program.
Now there are two main common ones that are normally used with Python.
The first is called an integer or int for short.
And the second is called a floating point number or a float for short.
So these are the two different types of no data types that you can work with in a python program.
It is important that you have a grasp of the differences between the two.
So you can use them appropriately.
So I'll start with integers integers are basically whole numbers or counting numbers.
That means they can also have negative numbers positive numbers which includes a zero as long as they
don't have decimal places after them.
So they are numbers without any decimals and they can be numbers that are on limited in length.
Examples include zero hundred negative eighty four hundred and so on.
As long as it is a whole number it can be positive or negative but must not have decimals floating point
numbers or a float are basically numbers that have decimal places so they can be positive and also they
can be negative but they must be numbers with decimal places.
Examples can include zero point zero four point five thirty eight point five negative twenty seven point
zero and so on.
So the key distinction between a floating point a float and an integer is the decimals a floating point
number as decimals are the integers are all numbers without decimals.
Knowing the distinction between the two will help you when you are working with the no data types in
Python.
It's important to understand the difference in the data types so that when you want to use them you
get the desired result.
So I am going to go into my python shell by typing in python in my command prompt on my windows machine.
I type in python and a press enter.
If you are using a Mac you need to type in Python 3 and press enter on your terminal.
So what I want to do I just want to use a simple print statement to print out a number and I'm going
to use a built in method in Python code type 2 Tell us what class of data type it is.
If it's either a float or an integer so to do that I just type in print and do a parentheses inside
the parentheses.
I'm going to use a python method called type it's a method so it has to be included in parentheses inside
that parentheses.
I'm going to include a whole number and I'm going to close that parentheses and then close the inner
parentheses so if I press enter it should tell me in the class of data type.
If it's an int or if it's a float so I expect it to tell me is it int so I press center.
You can still see here says is class INT.
Let's do another one that will tell us it's a float so I'll do a print and inside there.
Add to it type for that type method.
I will specify say twenty point zero.
Now close that.
Close your parentheses press enter.
You can see that the class has given me the value of float.
So once you understand the distinction between the two no data types the float and the int it will help
you decide what to use when you are building various types of application that relates to numbers.
So that's it for this video.
Thanks for watching.
Bye for now.