Skip to content

Commit

Permalink
Merge pull request #10 from ajitonelsonn/dev
Browse files Browse the repository at this point in the history
operasaun logika no boolean
  • Loading branch information
ajitonelsonn authored Apr 4, 2024
2 parents 4b8fd2e + 2f2e20a commit 5b41905
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
29 changes: 29 additions & 0 deletions operasaun logika no boolean/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# operasaun logika no boolean

Operasaun logika no boolean iha Python hanesan mekanizmu ne'ebé uza ba teste no kontrola fluxu iha programa. Ita bele utiliza operadores logika hanesan `and`, `or`, no `not` atu kombine kondisaun sira no hatudu rezultadu ho valor lógiku (`True` ka `False`).

Operadores logika sira iha Python:

1. `and`: Retorna `True` bainhira ambu operador sira ne'ebé kombine mak `True`.
2. `or`: Retorna `True` bainhira iha pelo menus ida husi ambu operador ne'ebé kombine mak `True`.
3. `not`: Inverte valor lógiku; `True` ba `False` no `False` ba `True`.

Ezemplu sira:

```python
# Operador "and"
print(True and True) # Sai True
print(True and False) # Sai False
print(False and True) # Sai False
print(False and False) # Sai False

# Operador "or"
print(True or True) # Sai True
print(True or False) # Sai True
print(False or True) # Sai True
print(False or False) # Sai False

# Operador "not"
print(not True) # Sai False
print(not False) # Sai True
```
48 changes: 48 additions & 0 deletions operasaun logika no boolean/exerciciu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
### Exerciciu I

Alguns exercísiu sira hodi pratika operadores logika no boolean iha Python:

1. **Exercísiu 1**: Verifika se númeru iha entre limites ne'ebé determina (5 no 10).

```python
num = int(input("Foti númeru: "))

# Verifika se númeru entre 5 no 10
between_limits = num >= 5 and num <= 10

print("Númeru entre 5 no 10:", between_limits)
```

2. **Exercísiu 2**: Verifika se uma iha tinan legal ba halo atividade desportu (tinan legal mak 18 ka tinan ki'ik liu).

```python
idade = int(input("Foti ita nia idade: "))

# Verifika se idade legal atu halo atividade desportu
pode_halodeporte = idade >= 18

print("Ita bele halo atividade desportu:", pode_halodeporte)
```

3. **Exercísiu 3**: Verifika se usuário iha permissaun ba halo edição iha sistema (permissaun bele mak `admin`).

```python
permissaun = input("Foti ita nia permissaun: ")

# Verifika se usuario iha permissaun administrador
tem_permissoes = permissaun == "admin"

print("Ita iha permissaun administrador:", tem_permissoes)
```

4. **Exercísiu 4**: Verifika se cliente bele hola deskontu espesiál iha loja (terdaftar no cliente lojal).

```python
terdaftar = True
cliente_lojal = True

# Verifika se cliente bele hola deskontu espesiál
bele_deskontu = terdaftar and cliente_lojal

print("Cliente bele hola deskontu espesiál:", bele_deskontu)
```
15 changes: 15 additions & 0 deletions operasaun logika no boolean/kode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Operador "and"
print(True and True) # Sai True
print(True and False) # Sai False
print(False and True) # Sai False
print(False and False) # Sai False

# Operador "or"
print(True or True) # Sai True
print(True or False) # Sai True
print(False or True) # Sai True
print(False or False) # Sai False

# Operador "not"
print(not True) # Sai False
print(not False) # Sai True

0 comments on commit 5b41905

Please sign in to comment.