Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Best Stock by BartoszKowalski
def best_stock(data):
# your code here
a = 0
b = 0
c = 0
d = 0
klucze = list(data.keys())
for i in data:
a = data[i]
c = c+1
if a>b:
b = data[i]
d = c
return klucze[d-1]
return 'GOOG'
if __name__ == '__main__':
print("Example:")
print(best_stock({
'CAC': 10.0,
'ATX': 390.2,
'WIG': 1.2
}))
# These "asserts" are used for self-checking and not for an auto-testing
assert best_stock({
'CAC': 10.0,
'ATX': 390.2,
'WIG': 1.2
}) == 'ATX', "First"
assert best_stock({
'CAC': 91.1,
'ATX': 1.01,
'TASI': 120.9
}) == 'TASI', "Second"
print("Coding complete? Click 'Check' to earn cool rewards!")
Nov. 17, 2018