Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
"Best Stock" solution in Uncategorized category for Best Stock by Mateusz_Wryszcz
def best_stock(data: dict[str, float]) -> str:
max_price = -1
best_stock = ""
for stock, price in data.items():
if price > max_price:
max_price = price
best_stock = stock
return best_stock
print("Example:")
print(best_stock({"CAC": 10.0, "ATX": 390.2, "WIG": 1.2}))
assert best_stock({"CAC": 10.0, "ATX": 390.2, "WIG": 1.2}) == "ATX"
assert best_stock({"CAC": 91.1, "ATX": 1.01, "TASI": 120.9}) == "TASI"
print("The mission is done! Click 'Check Solution' to earn rewards!")
Dec. 30, 2022