Skip to content

Commit 629e5ee

Browse files
committed
criação do metodo inicial nome
1 parent 835238d commit 629e5ee

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎oo/pessoa.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22

33

44
class Pessoa:
5+
6+
def __init__(self, nome = None):
7+
self.nome = nome
8+
59
def cumprimentar(self):
610
return f'olá {id(self)}'
711

812
if __name__ == '__main__':
9-
p = Pessoa()
10-
13+
p = Pessoa('Angelina')
1114
print(Pessoa.cumprimentar(p))
1215
print(dir(p))
1316
print(p.cumprimentar())
17+
print(p.nome)
18+
p.nome = 'Telmo'
19+
print(p.nome)
1420

0 commit comments

Comments
 (0)