Booleans are integers?!
Hi, Welcome to this short section. We will discuss Booleans
and the fact that the fact that they can be used as integers in your code.
This is a curious fact and I thought it would be interesting
to share it with you! J
Let’s get started!
You can find the article on Python Documentation under numbers.Integral:
Here are some demonstrations in the Shell of how we can
compare and operate on True and False as if they were integers 1 and 0
respectively.
Hope it helps! If you have any questions, please ask them in
the forums, your classmates and Community TAs will always be there to help you!
Estefania.
Comments
Post a Comment