Created
April 18, 2014 17:59
-
-
Save samueltcsantos/11056574 to your computer and use it in GitHub Desktop.
Estrutura condicional em Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Created on 18/04/2014 | |
@author: Samuel T. C. Santos | |
Estrutura de descisao em Python if-else | |
''' | |
x = 10 | |
#condicional simples | |
if (x < 15): | |
print 'x eh menor que 15' | |
idade = 15 | |
if (idade < 16): | |
print 'Voce nao pode dirigir' | |
else: | |
print 'Voce ja pode dirigir' | |
temCarteira = False | |
#condicional encadeiada | |
if (idade < 16): | |
print 'Nao pode dirigir e nem tirar habilitacao!' | |
elif (temCarteira == True): | |
print 'Voce pode dirigir' | |
else: | |
print 'Voce deve fazer sua habilitacao para dirigir!' | |
''' | |
Saida do Programa: | |
x eh menor que 15 | |
Voce nao pode dirigir | |
Nao pode dirigir e nem tirar habilitacao! | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment