How to convert from one number type to another? #shorts #python

preview_player
Показать описание
You can convert numbers using the following functions:

int(): will result in an integer
float(): will result in floating-point numbers
complex(): will result in complex

Example 1:

x = 2.2
print(int(x))

Output:
2

Example 2:

x = 2
print(float(x))

Output:
2.0

Example 1:

x = 2
print(complex(x))

Output:
2+0j

--------------------------Subscribe-----------------------------
• If you like to see a variety of fun and interactive projects written in Python
• If you love ☕ and 🐶 WAIT! - Yeah! Definitely, coffee and dogs!
-----------------------------------------------------------------------

--------------------------Socials-----------------------------
------------------------------------------------------------------

--------------------------Support-----------------------------
--------------------------------------------------------------------

How to convert from one number type to another? #shorts #python #iftodd
Рекомендации по теме
welcome to shbcf.ru