Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
Ask HN: Why does print (0.1 and 0.1 and 0.1 == 0.3) evaluate to False in Python? | Better HN
Ask HN: Why does print (0.1 and 0.1 and 0.1 == 0.3) evaluate to False in Python?
2 points
AlexHerbert
5y ago
3 comments
Share
3 comments
default
newest
oldest
edrobap
5y ago
Explanation for this behaviour is explained here -
https://docs.python.org/3/library/decimal.html
asplake
5y ago
Floating point isn't the issue. 'and' is a logical operator here. 0.1 and 0.1 is 0.1.
1 more reply
AlexHerbert
OP
5y ago
Thank you
j
/
k
navigate · click thread line to collapse