OneBite.Dev - Coding blog in a bite size

declare a float number in python

Code snippet on how to declare a float number in python

num = 10.5

This code is declaring a float number in Python. The variable name is ‘num’, and it is assigned to the float number 10.5. The variable ‘num’ can now be used as a variable for calculations, for example expressing the result of a mathematical operation. The float data type is useful for working with decimal numbers, as opposed to integers that can only represent whole numbers.

python