Type Casting
Type casting refers to the process of converting a variable from one data type to another. Variables can contain various types of data such as text (called a string), a whole number (called an integer), or a floating point number (numbers with decimal points). With Python, you don’t have to declare all your variables before you use them. However, you might need to convert variables to different types. This is known as type casting.
Python has two types of type conversion: implicit & explicit.
With implicit type conversion, Python automatically converts one data type to another.
With explicit type conversion, the programmer converts the data type to the required data type using a specific function. You can the following functions ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access