Python Training Program Session 5 (Part 1) || Type Casting In Python || Python Operators

Publicado el: 12 agosto 2021
en el canal de: Sunidhi Pandey
24
3

Hello Everyone! Today in this video I am going to explain about Type Casting In Python & Python Operators .

✻ I really hope you find this video useful.

Type Casting In Python :

Sometimes in our program, it is necessary for us to convert from one data type to another, such as from an integer to a string.
This is known as type casting.

There are three built-in functions in Python that allow us to do type casting:
int()
float()
str()

The int() function in Python takes in a float or an appropriate string and converts it to an integer.

To change a float to an integer, we can type int(5.712987). We’ll get 5 as the result (anything after the decimal point is removed).

To change a string to an integer, we can type int("4") and we’ll get 4.

However, we cannot type int("Hello') or int("4.22321"). We’ll get an error in both cases.

The float() function takes in an integer or an appropriate string and changes it to a float.

For instance, if we type float(2) or float("2"), we’ll get 2.0. If we type float("2.09109"), we’ll get 2.09109 which is a float and not a string since the quotation marks are removed.

The str() function on the other hand converts an integer or a float to a string.

For instance, if we type str(2.1), we’ll get "2.1".

Note: The input() function accepts all inputs as strings only. Therefore we need to typecast them to the suitable data type before they can be used.

Python Operators
Operators are used to perform operations on variables and values.

Python divides the operators in the following groups:

Arithmetic operators
Assignment operators
Comparison operators
Logical operators
Identity operators
Membership operators
Bitwise operators

#Python #PythonTraining #JupyterNotebook #TypeCasting #Operators

---------------------------------------------------------------------------

THANK YOU so much for watching!
Please make sure to LIKE and SHARE the video and SUBSCRIBE to the channel for more such videos :)

---------------------------------------------------------------------------
CONNECT WITH ME ON:
✻ LinkedIn:   / sunidhi-pandey-96008b192  
✻ GitHub: https://github.com/sunidhi2001
✻ YouTube channel:    / @sunidhipandey  
✻ Instagram :   / 20sunidhi  


En esta página del sitio puede ver el video en línea Python Training Program Session 5 (Part 1) || Type Casting In Python || Python Operators de Duración hora minuto segunda en buena calidad , que subió el usuario Sunidhi Pandey 12 agosto 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 24 veces y le gustó 3 a los espectadores. Disfruta viendo!