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 ...
Get Python Made Easy now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.