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

operasaun logika no boolean #10

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading