#Python #Shorts
Sometimes you may want to check if the result you get after performing some math operation is the whole number.
Python makes it easy for us to do this by calling the "is_integer" method on a float.
For example, if we have code like x = 5 / 2, we can do x.is_integer() to check if it's a whole number or not (it isn't since 5 / 2 is 2.5).
-------------------------------------------------------------------------------------
Links:
Blog: https://evgenyurubkov.com
Twitter: / evgenyurubkov
Instagram: / evgenyurubkov
Youtube: / @codevev
Смотрите видео Python - Check If Number Is An Integer онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь codevev 30 Август 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,083 раз и оно понравилось 19 людям.