File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11class Pessoa :
2- def __init__ (self , nome = None , idade = 27 ): # atributos
2+ def __init__ (self ,* filhos , nome = None , idade = 27 ): # atributos
3+ self .nome = nome
34 self .idade = idade
4- self .nome = nome
5+ self .lfi = list (filhos )
6+
7+
8+
59 def cumprimentar (self ):
610 return f'Olá Mundo { self .nome } ' # se verificar o id de self é o mesmo do p!
711
812if __name__ == '__main__' :
9- p = Pessoa ('Teste' ) # chama a classe pessoas mandando a str Teste para nome
10- print (p .cumprimentar () )
13+ daniele = Pessoa (nome = 'Daniele' ) # chama a classe pessoas mandando a str Teste para nome
14+ michel = Pessoa (daniele , nome = 'Michel' )
15+ for i in michel .lfi :
16+ print (i .nome )
17+ # print(cadastro.cumprimentar())
1118 #mudando atributos
12- p .nome = 'Michel' # agora atribuindo a str Michel.
13- print (p .cumprimentar (),p .idade )
19+ #cadastro .nome= 'Michel' # agora atribuindo a str Michel.
20+ # print(cadastro .cumprimentar(), cadastro .idade)
1421
You can’t perform that action at this time.
0 commit comments