Data Types in Python

7 minutes
Share the link to this page
Copied
  Completed
This video illustrates basic data types and operations in python. -Addition -Subtraction -Multiplication -Division -Modulus -Square root -Checking data type of variable. -Float -Integer -String -Boolean and -Conversion of data types

Transcript

Hello, this video is created to explore different operations and data types in Python. Python is very simple and very easy to learn. And therefore I have chosen Python to actually create a course. You can see here, a plus by if I change the values for plus by and just run the code. So it gives me nine for subtraction, seven minus four, and it will give me if I change the value, eight minus four. Okay?

I run the code. So here's four. Similarly, multiplication, three into two, or three to five is 15. And seven divided by five is 4.4. You can see here I have not declared any variables with it. It's just doing simple math calculations and giving answers and the answers are also on does not require it to be, like defined before hand directed produces the answer.

For modulars 18 modules seven, it gives for archery but declared bid 19. So it gives by, similarly for the patient 68.7 divided by 1.7, it gives its answer. You can see here to create a float value. Python is a great calculator. However, in order in order to do complex calculation, we have to say values and use variables. In Python, we can create variables just by declaring it.

For example, I created this variable BMI equals 260 8.7 divided by 1.79 to the power square. So these two multiplication signs declared that 1.79 is to the powers of two and we can get the answer. The PMI has a value. We'd like them P it has the value 21.4 bytes with automatically declared the type of its variable when I created it. And it doesn't because it has an engine that validates the type. What type of answer it is Gary does it automatically.

So this is the answer. We can check the variable type we're using the type function here, the type function when it passed, will this be with BMI to it? It gives me float code again. It gives float. Do you have to be good? It's really powerful and many passed to this day of P is the type function as parameter I get an integer.

Here I create this variable x and I store a string in it body mass index. create another variable one next door is higher and when I create another variable set and add these two variables. When I get body mass index is higher. So actually, what am I getting into here? plus operator? Well, it's very different in Python, it just adds if you're passing two variables inside are actually two strings inside two variables and you get to add together it gives an answer that is the common a, that actually some actually that add up of both those trends.

And here in C set went past footprint function. It's this answer, that is the is the sum of x and y axis body mass index and why is is higher? just added these two variables to that to that and it created the answer. One more thing Python variables are case sensitive. So, if I declares that here as small and I write down an impossible capital set here, it won't give me an answer instead it would create an error. It see here name Zed is not defined, here the variables are case sensitive.

And I declared it again when I pass small, basically a small set through this again. So you can see here, whether except the simple expression passed within inverted commas, I said does the mathematics function applies to to the strength as well. He that needs to be multiplied by two it means there is going to be to hate and then person that their hair he that his third one and what it outputs I say He, so it's very easy and great way to to like learn and apply. Now, in Python there are functions that converts the data type, for example, the day of P or the or B, we saw that it's data type it was any teacher, we can convert that into when a parcel D of t into load function, I get this. Now, I when I take it again, for example, I had an A C type of be understood.

The This is an A teacher. However, when I did find the app, the V wrote and I see this to type the code in the code and type this code see the DFP what they originally in teacher, I convert this into code using this thought function and stored the answer in a V dot variable and a PATH variable. And I caught this. So quite simple and fast. I hope now you have a better understanding of Python data types and if you were doing Python data types with First time I hope now you know more about data types. basics basic and four data types in Python are real numbers.

Teacher string. These are strings of text and only one false one or zero. I hope you enjoyed it. Thank you

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.