Understanding Type Casting Examples in Python || Lesson 25 || Python For Beginners ||

Publicado el: 29 junio 2026
en el canal de: Wisdomers - Placements & Programming
No
0

In this class we discuss understanding type casting examples in python

0:00 intro type coercion or implicit type conversion
0:42 Type casting examples int
1:35 type casting examples float
1:58 Boolean to int conversion
2:11 Bool type conversion
2:52 other functions for type casting

Welcome, Wisdomers! In today’s session, we are shifting our focus to Type Casting in Python.
In our previous class, we explored Type Coercion, or implicit conversion, where the Python interpreter handles data transformations automatically. Today, we dive into Explicit Type Conversion. Unlike coercion, Type Casting requires the programmer to manually define the conversion within the code. This gives you precise control over how your data is handled and transformed to meet your specific requirements.
Let’s explore how to take charge of your data types.


take a look at the code. the variable x is floating value. if we want to convert the float to integer value we use int function as mentioned in the code int of x. the integer part of 10.1 is 10. the variable y contains integer 10.
take a look at the next line of code where x is string data type. i want you to think about our previous UTF-8 encoding for strings. the way strings are stored is different when compared to integers. check the next line of code string data type is converted to integer type using int function. now the variable y contains integer 10.


Similarly, you can understand the next code very easily.
take a look at the first code converting string to float we use float function.
one should understand if you want to convert any other type to float data type we use float function.
same as we used int function for integer data type.
take a look at the second code. we use to convert boolean data type to integer.
as we discussed previously False means zero and true means 1. so our output is 1.
now coming to third example. we converted integer to boolean data type using bool function.
if we place integer zero. it is converted to false. other wise to true.


finally one should understand this important point. take a look at the code.
we are trying to convert string AB to integer. is it possible? No. this will show you error. please try the code.
in our later classes we discuss about list, set, dictionary, and tuple data types. list can be converted to set data type using set function.
just have a look at those functions we use them later.


visit our learning agent www.wisdomers.in for quizzes and projects


En esta página del sitio puede ver el video en línea Understanding Type Casting Examples in Python || Lesson 25 || Python For Beginners || de Duración hora minuto segunda en buena calidad , que subió el usuario Wisdomers - Placements & Programming 29 junio 2026, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto No veces y le gustó 0 a los espectadores. Disfruta viendo!