Skip to content

Commit d7495e1

Browse files
author
Luan Carvalho
committed
Criado atributos de instancia nome e idade.
1 parent 02ae0a4 commit d7495e1

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

oo/pessoa.py

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

59
if __name__=='__main__':
6-
p = Pessoa()
10+
p = Pessoa('Luan')
711
print(Pessoa.cumprimentar(p))
812
print(id(p))
913
print(p.cumprimentar())
14+
print(p.nome)
15+
print(p.idade)
16+

0 commit comments

Comments
 (0)