From the course: Introduction to Python: Learn How to Program Today with Python by Pearson

Unlock this course with a free trial

Join today to access over 25,400 courses taught by industry experts.

Learn about types

Learn about types

Okay, so one of the most basic concepts to start wrapping your head around with programming is the concept of types. And in Python, there's a bunch of types that we've seen already, but the reason there are different types is because there's different ways of storing data, different methods and and functions that can be used on different types of data. And yeah, it's just kind of grouped. I'm going back to the Python console here, and we've seen some types already. So for example, whole numbers are considered integers, okay? Whereas if they have a decimal place, they're now floats. And we can see the type of something by using the built-in type function, okay? So it's something that you can just use, like print. It's called type. We put parentheses afterwards and pass something in. And it'll return or print out what type it is. So this has the type of class int, which stands for integer. And then 1.0 is float. Other types that we've seen are characters. If it's in quotes, it's a…

Contents