Skip to content

Commit 581a028

Browse files
committed
Criados atributos de instância nome e idade
1 parent a86e3b0 commit 581a028

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

oo/pessoa.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
class Pessoa():
2+
3+
def __init__(self, nome=None, idade=35):
4+
self.nome = nome
5+
self.idade = idade
6+
27
def cumprimentar(self):
38
return f'Olá, {id(self)}'
49

510

611
if __name__ == "__main__":
7-
p = Pessoa()
12+
p = Pessoa('Dênison')
13+
print(Pessoa.cumprimentar(p))
814
print(id(p))
915
print(p.cumprimentar())
16+
p.nome = 'Jhonny'
17+
print(p.nome)
18+
print(p.idade)

0 commit comments

Comments
 (0)