python float datatype - assigning a float value to a variable - floating-point value using float() class
float datatype
![]() |
python float datatype |
we can declare float variable in two ways
1)Directly assigning a float value to a variable
2)Using a float() class.
#Directly assigning a float value to a variable
intrest=1250.80
print("intrest is ",intrest)
print(type(intrest))
output:
1250.80
# store a floating-point value using float() class
num = float(54)
print(num)
print(type(num))
output:
54.0
Comments
Post a Comment