From the course: Python Theory for Network Engineers

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Python numbers and math

Python numbers and math

- [Instructor] When it comes to numerics, the two main types or data types are int and float. So they're, let's say, int and float. For numbers that does not have a decimal point, we could use int. Otherwise we use float. And we could have a variable again to assign and have the values of int, for example. So if I do age 65 and I do a type and age. I could see that this is an int. But if I say age 65.0 and if I do a type, you could see that's a float because you could represent numbers with decimal points and carry out a larger representation of this number, as well. So let me go ahead and represent age back into 65, because it's kind of weird to have an age with a decimal point. I suppose you could, but, you know, I guess it's a little bit weird. And we could also convert between the two, right? So my number, I could say my_num equals to 10, and if I do a type, you could see my_num is a int, but if I do a float,…

Contents