Created
March 7, 2014 17:56
-
-
Save Marlysson/9416422 to your computer and use it in GitHub Desktop.
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
class Pessoa(): | |
def __init__(self,nome,idade): | |
self.nome = nome | |
self.idade = int(input('Quantos anos você tem: ') | |
def verifica(self): | |
maior = '' | |
if self.idade > 18: | |
maior = 'é' | |
else: | |
maior = 'não é' | |
print ('{},{},{} maior de idade.'.format(self.nome,self.idade,maior)) | |
pessoa1 = Pessoa('Teste1',17) | |
pessoa2 = Pessoa('Teste2',30) | |
print (pessoa1.verifica()) | |
print (pessoa2.verifica()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1º código POO. Classe para descobrir se é maior de idade.