What is the difference between an Integer and a Float?

Asked by stem_mind · 4 months ago

1 Answer

30
amorebise · 4 months ago Top Answer

An Integer is a whole number, like 5 people or 100 Naira. A Float has a decimal point, like 1.5 liters of fuel or ₦10.50.

Think of it like counting eggs versus measuring fuel. You can't have 1.5 eggs, but you can certainly have 1.5 liters of petrol. Python needs to know which one you are using so it can be precise.

Log in to add a comment.