Aula07 - ex05 fixed

This commit is contained in:
tiagorg 2022-11-12 22:00:09 +00:00
parent c795d877a4
commit 5ba131d277
2 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,6 @@
# Fundamentos de Programação # Fundamentos de Programação
## Aula 07 - [Slides](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/fp/slides/tp07-dictionaries.pdf) ## Aula 07 - [Slides](https://github.com/TiagoRG/uaveiro-leci/blob/master/1ano/fp/slides/tp07-dictionaries.pdf)
### Tópico principal da aula: Dictionaries ### Tópico principal da aula: Dictionaries
#### Exercícios em falta: ex05.d)
--- ---
*Pode conter erros, caso encontre algum, crie um* [*ticket*](https://github.com/TiagoRG/uaveiro-leci/issues/new) *Pode conter erros, caso encontre algum, crie um* [*ticket*](https://github.com/TiagoRG/uaveiro-leci/issues/new)

View File

@ -84,11 +84,12 @@ def stocksByDateByName(lst):
return dic return dic
# Função não completa
def portfolioValue(stocks, portfolio, date): def portfolioValue(stocks, portfolio, date):
assert date in stocks assert date in stocks
val = 0.0 val = 0.0
# Complete ... # Complete ...
for comp in portfolio:
val += portfolio[comp] * stocks[date][comp][CLOSE]
return val return val