+ 1

# Difference between float and int

6 Antworten

+ 7

Integer and float are two different kind of datatype that stores different kind of numerical data in a particular variable.
An integer is a number without a decimal point that means these are just a numbers like 1,2,34,344 etc.
A float is a number with a decimal point that means these are just a numbers with points like 1.5,2.56,34.667,344.678 etc.
Float datatype is used when more precision is required.

+ 1

Int is like this 1,3,4,6,7 etc
Float is like this 5.56,7.78,98.00000,799.9076995 etc

0

Hi AJ

0

A float has decimal points like 3.5, 6.7, 87.56, etc.... But a integer is a like a whole number which can be positive or negative like 67, 45, -4, -35, etc

0

integers are numbers without a decimal point, whereas floats are numbers with a decimal point.
An additional information : double is more precise than float , double can store 64 bits ( and float can store only 32 bits )
Double is for storing large numbers
Enjoy your learning bro ❤️

0

If you want to see something fun with floats in Python, look at the output of 1.0 + 2.0