Type Conversions

In this lesson, we'll take a look at some of the built-in functions offered by Python for type conversions.

We'll cover the following

There may be times when we need to change data from one type to another. In Python, this is usually an easy process since the compiler can automatically convert data between different types in order to avoid errors.

However, there are built-in functions which allow us to perform explicit type conversions.

Let’s explore them in this lesson.

int()

To convert data into an integer, we can use the int() utility.

Keep in mind, a string can only be converted to an integer if it is made up of numbers.

Get hands-on with 1200+ tech skills courses.