Skip to content
← Back to Community
What are floats in python?
Profile icon
YvngBashit

What are floats in python?

Voters
Profile icon
MarkCheng6
Profile icon
YvngBashit
Comments
hotnewtop
Profile icon
Geocube101

Floats are basically decimals
integer = 5
float = 5.0

Profile icon
RYANTADIPARTHI

Floats are basically decimals. like this:

a int is = 1 a float is = 1.0

to turn to a float, it's like this:

d = 10 s = d.float() print(s)

That should work

Profile icon
ADoctor

Floats work similarly to decimals. Integers cannot have any decimal places, whereas floats are always displayed with at least one (if there are none specified, a '.0' will be added at the end).