Integer and Floats | Python | Code With Me

Опубликовано: 05 Октябрь 2022
на канале: NotThatGeeky
62
3

This is the video for integer and floats in python language.


Integers and Floats
There are two Python data types that could be used for numeric values:

int - for integer values
float - for decimal or floating point values
You can create a value that follows the data type by using the following syntax:

x = int(4.7) # x is now an integer 4
y = float(4) # y is now a float of 4.0
You can check the type by using the type function:

print(type(x))
int
print(type(y))
float
Because the float, or approximation, for 0.1 is actually slightly more than 0.1, when we add several of them together we can see the difference between the mathematically correct answer and the one that Python creates.

print(.1 + .1 + .1 == .3)
False


do subscribe if you enjoy.
CODE WITH ME
next-    • Whitespacs | Python | Code With Me  


На этой странице сайта вы можете посмотреть видео онлайн Integer and Floats | Python | Code With Me длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь NotThatGeeky 05 Октябрь 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 62 раз и оно понравилось 3 зрителям. Приятного просмотра!