python float datatype - assigning a float value to a variable - floating-point value using float() class

 float datatype

python 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


No comments:

Post a Comment

Latest Post

Don’t Sweat It – Chill with Crompton Air Cooler Deals

 ðŸŒž Don’t Sweat It – Chill with Crompton Air Cooler Deals  More Details : https://www.amazon.in/s?k=laptops+under+70000&crid=29QIFPXQYB3...