220k views
5 votes
How do I add decimals in python?

User Ramanr
by
5.6k points

1 Answer

5 votes

x = 0.6

y = 0.4

print(x + y)

This will output 1.0 to the console.

You could also just do:

print(0.6+0.4)

This will yield the same result.

User Ehsan Jeihani
by
5.9k points