Skip to content

Commit 78a7ead

Browse files
committed
Criação método cumprimentar e atributos nome e idade
1 parent ade57a1 commit 78a7ead

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

oo/pessoa.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
class Pessoa:
2+
def __init__(self, nome=None, idade=47):
3+
self.nome = nome
4+
25
def cumprimentar(self):
36
return f'Olá {id(self)}'
47

58

69
if __name__ == '__main__':
7-
p = Pessoa()
10+
p = Pessoa('Itiro')
811
print(Pessoa.cumprimentar(p))
912
print(id(p))
1013
print(p.cumprimentar())
14+
print(p.nome)
15+
p.nome = 'Alexandre'
16+
print(p.nome)

0 commit comments

Comments
 (0)