Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaldojr committed Oct 16, 2024
1 parent 4a19c46 commit 973c240
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions material/aulas/ctp/python/decision-structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ Estes operadores são usados para comparar valores:
<?quiz?>

question: Dado `x = 5` e `y = 10`, qual das seguintes afirmações é verdadeira?
answer-correct: `x < y`
answer: `x > y`
answer: `x == y`
answer: `x >= y`
answer-correct: x < y
answer: x > y
answer: x == y
answer: x >= y
content:
`x < y` é verdadeiro porque 5 é menor que 10.
<?/quiz?>

<?quiz?>

question: Se `a = "hello"` e `b = "world"`, qual das seguintes condições é verdadeira?
answer: `a == b`
answer-correct: `a != b`
answer: `a > b`
answer: `a < b`
answer: a == b
answer-correct: a != b
answer: a > b
answer: a < b
content:
`a != b` é verdadeiro porque "hello" é diferente de "world".
<?/quiz?>
Expand All @@ -54,30 +54,26 @@ Estes operadores são usados para combinar condições:
<?quiz?>

question: Dado `x = True` e `y = False`, qual das seguintes expressões retorna `True`?
answer-correct: `x and not y`
answer: `not x and y`
answer: `x and y`
answer: `not x or y`
answer-correct: x and not y
answer: not x and y
answer: x and y
answer: not x or y
content:
`x and not y` retorna `True` porque `x` é verdadeiro e `y` é falso (e `not y` é verdadeiro).
<?/quiz?>

<?quiz?>

question: Se `m = False` e `n = False`, qual das seguintes expressões é `True`?
answer: `m and n`
answer: `m or n`
answer-correct: `not m and not n`
answer: `not m or n`
answer: m and n
answer: m or n
answer-correct: not m and not n
answer: not m or n
content:
`not m and not n` é verdadeiro porque ambos `m` e `n` são falsos e a negação de ambos é verdadeira.
<?/quiz?>


!!! progress
Continuar...


### A Estrutura `if`

A estrutura `if` é a base das estruturas de decisão em Python. Ela avalia uma condição e, se essa condição for verdadeira, executa o bloco de código indentado sob ela.
Expand Down Expand Up @@ -117,6 +113,7 @@ O `else` captura qualquer condição que não tenha sido capturada pelas cláusu

### Exercícios sobre `else`


```quiz
{
"questao": "Dado o código abaixo, qual será a saída se `num = 10`?",
Expand All @@ -137,6 +134,7 @@ else:
}
```


<?quiz?>

question: Usando o mesmo código, qual será a saída se `num = 15`?
Expand Down

0 comments on commit 973c240

Please sign in to comment.