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

How to Generate Barcode and QR code For Our Products

 మీ products కి barcode / QR code generate చేయాలంటే OPTION 1: ONLINE (No Coding – Quick) Best for small shops / beginners 👉Free websites: T...