Reputation: 9288
I was reading some Python code:
math.ceil(.1) + math.floor(.1)
and have encountered the following notation - .1
.
Could someone explain what does it mean?
Thanks in advance.
Upvotes: 0
Views: 391
Reputation: 18826
The integer is a float (decimal) value
>>> .1
0.1
>>> 1
1
As Shashank V's answer notes, one can can check the type of an object by calling type()
on it!
>>> type(.1)
<class 'float'>
>>> a = .1
>>> type(a)
<class 'float'>
Upvotes: 4
Reputation: 11213
It's a float. .1
represent the decimal value 0.1
>>> type(.1)
<class 'float'>
https://docs.python.org/3/tutorial/floatingpoint.html
Upvotes: 3