If e else Python
-
Upload
danilo-costa -
Category
Software
-
view
84 -
download
1
description
Transcript of If e else Python
1 Structuring if statements
Universidade Federal de Alagoas Discentes: Danilo Victor B. da Costa e
Roberto Bartolomeu
OBJETIVOS:
1. Apresentar o significado do termos “If”, “elif” e “else”.
2. Apresentar a estrutura para o correto uso dos termos descritos.
2 Structuring if statements
O QUE É “IF”?
A palavra “if/else”, assim como algumas outras, são reservadas em Python, isso quer dizer que ela não deve ser utilizada para nomear variáveis, classes e etc. A palavra “if” vem do inglês e quer dizer “se” no sentido condicional: "Se alguém estiver lendo eu continuo postando“.
https://under-linux.org/entry.php?b=1583
3 Structuring if statements
Ao estruturar um código, fazendo o uso do “if”, devemos obedecer a seguinte sintaxe .
Exemplo 1:
4 Structuring if statements
Na estrutura lógica condicional podemos fazer uso não só do “if”, mas também do “else” e do “elif”.
• else: se não.
• elif: uma junção do if mais o else, para assim simplificar o código.
5 Structuring if statements
Uso do if e do else . Exemplo 2 :
6 Structuring if statements
7
Uso do if ,do else e do elif . Exemplo 3 :
Structuring if statements
BIBLIOGRAFIA:
• Guido van Rossum e Fred L. Drake, Jr.
Tutorial Python. Release 2.4.2
Tradução: Python Brasil
• https://under-linux.org/entry.php?b=1590
8 Structuring if statements
PERGUNTAS?
9 Structuring if statements