Skip to content

Instantly share code, notes, and snippets.

@Marlysson
Created March 7, 2014 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marlysson/9416422 to your computer and use it in GitHub Desktop.
Save Marlysson/9416422 to your computer and use it in GitHub Desktop.
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())
@Marlysson
Copy link
Author

1º código POO. Classe para descobrir se é maior de idade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment