Skip to content

Commit 2371749

Browse files
committed
Criado método cumprimentar e attr de instancia nome e idade
1 parent 70019b1 commit 2371749

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

oo/pessoa.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
class Pessoa:
2-
pass
2+
def __init__(self, nome=None, idade=38):
3+
self.nome = nome
4+
self.idade = idade
5+
6+
def cumprimentar(self):
7+
return f"olá {self.nome} com a idade de {self.idade}"
8+
9+
if __name__ == '__main__':
10+
p = Pessoa(nome="jose")
11+
print (p.cumprimentar())
12+
print(id(p.cumprimentar()))

0 commit comments

Comments
 (0)