Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

True and False interpretion #32626

Merged
merged 4 commits into from May 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion guide/english/python/boolean-operations/index.md
Expand Up @@ -31,7 +31,7 @@ not x | if x is false, then True, else False | (3)
False
```
### `and`:
``
```
>>> True and False # Second argument is evaluated.
False
>>> False and True # Short-circuted at first argument.
Expand All @@ -47,6 +47,17 @@ not x | if x is false, then True, else False | (3)
True
```

## How python sees True and False

For python `True==1` and `False==0`

```python
1 and False //False
0 and 1 //False
1 and True //True
1 or 0 //True
```

## Other boolean-operations:

These are other boolean operations which are not part of the Python language, you will have to define them yourself or use the boolean expression within the parenteses.
Expand Down Expand Up @@ -202,3 +213,4 @@ xnor ( not (x or y) or (x and y) ) | |
False
>>> not(not(False or False) or (False and False)) # Second argument is evaluated.
True
```