Skip to content

Commit d554a88

Browse files
committed
Criados atributo de instancia nome e idade
1 parent 21129d2 commit d554a88

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

oo/pessoa.py

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

510
if __name__ == '__main__':
6-
p = Pessoa()
11+
p = Pessoa('Luciano')
712
print(Pessoa.cumprimentar(p))
813
print(id(p))
914
print(p.cumprimentar())
10-
15+
print(p.nome)
16+
p.nome = 'Renzo'
17+
print(p.nome)
18+
print(p.idade)

0 commit comments

Comments
 (0)