Hi guys!
Got stuck with lists, which contain nested lists with this code:
import re
def fastest_horse(horses: list) -> int:
int_horses = []
for item in horses:
for sub_el in item:
indigits = re.sub('[^0-9]','', sub_el)
print(indigits)
smallest_time = int(indigits)
print(smallest_time)
int_horses.append(smallest_time)
print(int_horses)
a = int_horses.index(min(int_horses)) + 1
print(a)
return a
Where I should move to make it work correctly?
For example, this assert assert fastest_horse([['1:13', '1:26', '1:11'], ['1:10', '1:18', '1:14'], ['1:20', '1:23', '1:15']]) == 3 returns 1 insead of 3
Created at: 2019/09/15 16:41; Updated at: 2019/09/15 20:20
The question is resolved.