-
Notifications
You must be signed in to change notification settings - Fork 38
projeto_semana_08_Lais #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
mayaracsferreira
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lais, parabéns pela entrega!!
Achei muito interessante o seu raciocinio, deixei alguns comentarios mas são apenas sugestões e algumas dicas. Orientação a objetos não é algo trivial mas vc está indo muito bem! Achei muito massa que usou os comentarios para entender o que o codigo está fazendo! Parabéns!! Vc ainda vai longe!
| autor_livro = 'Brené Brown' | ||
| livro = Livro(nome = nome_livro, autor = autor_livro) | ||
| self.biblioteca.adicionar_livro(livro) | ||
| # neste momento foi preciso importar a classe Livro |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muito bacana que utilizou comentários para se organizar e documentar o que está sendo feito no código!
| #Act | ||
| self.biblioteca.exibir_livro(livro) | ||
| #Assert | ||
| self.assertEqual(livro_nome, 'A pedagogia do oprimido') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
|
|
||
| def exibir_livro(self, livro: Livro): | ||
| # raise NotImplementedError | ||
| self.livros = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aqui nessa linha, vc estaria limpando a a lista de livros toda vez que vai exibir os livros, talvez isso não seja necessário aqui (mas poderia ter um método de exclui_todos_livros, talvez? pode ser interessante)
Aqui bastaria retornar a lista como ela se encontra mesmo
| print(livro) | ||
|
|
||
| def emprestar_livro(self): | ||
| if self.emprestar_livro is False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aqui vc está fazendo uma coisa interessante, vc já viu o conceito de recursividade ou recursão?
Aqui vc está usando esse conceito chamando o método dentro dele mesmo
Um site que ajuda muito a entender a lógica é o https://pythontutor.com/
Nesse site vc consegue fazer teste de mesa e ir debugando o código
| self.livros = [] | ||
| print(livro) | ||
|
|
||
| def emprestar_livro(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aqui está no caminho certo!
Mas que acha dessa sugestão de algoritmo?
- receber um livro ou nome de um livro como parametro do metodo emprestar_livro
- iterar sobre a lista self.livros (fazer um for)
- verificar se o livro atual do for tem o mesmo nome do parametro recebido
- Se tiver o mesmo nome então altera o valor do livro de dentro da lista para livro.esta_Emprestado = True (opcionalmente vc pode retornar True também, isso pode facilitar os testes)
- Se não tiver o mesmo nome então não faz nada (opcionalmente vc pode retornar False também, isso pode facilitar os testes)
No description provided.