dunossauro / dunossauro/live-de-python

[SUGESTÃO] Live: Operadores Lógicos Booleanos em Python

Open
#265 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.3k
Forks
217
PR merge metrics
No merged PRs in 30d

Description

**AND, && (E)**
Verdadeiro se as duas entradas forem verdadeiras, caso contrário falso.
```py3
1 and 1 # 1
0 and 1 # 0
1 and 0 # 0
0 and 0 # 0
```

**OR, || (OU)**
Verdadeiro se pelo menos uma das entradas forem verdadeiras, caso contrário falso.
```py3
1 or 1 # 1
0 or 1 # 1
1 or 0 # 1
0 or 0 # 0
```

**NOT, ! (NÃO)**
Inverte o valor de entrada.
```py3
not 0 # 1
not 1 # 0
```

**XOR, ^ (Exclusive OR | OU Exclusivo)**
Verdadeiro apenas se as duas entradas forem diferentes, caso contrário falso.
```py3
1 ^ 1 # 0
0 ^ 1 # 1
1 ^ 0 # 1
0 ^ 0 # 0
```

**NAND (Not AND | Não AND)**
Apenas a inversão do AND.
```py3
not (1 and 1) # 0
not (0 and 1) # 1
not (1 and 0) # 1
not (0 and 0) # 1
```

**NOR (Not OR | Não OR)**
Apenas a inversão do OR.
```py3
not (1 or 1) # 0
not (0 or 1) # 0
not (1 or 0) # 0
not (0 or 0) # 1
```

**XNOR (Not Exclusive OR)**
Apenas a inversão do XOR.
```py3
not (1 ^ 1) # 1
not (0 ^ 1) # 0
not (1 ^ 0) # 0
not (0 ^ 0) # 1
```

É um tema que dá grandes poderes, acho que vale a pena..

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.