Apr-10-2019, 03:28 AM
Function 'greedy_cow_transport' parameter 'cows' is dictionary. On row #12 you use sorted on this dictionary. Result is not dictionary anymore - it's a list of keys ("Return a new sorted list from the items in iterable.").
I observed that on row #16 you append 'cow'. This name is not assigned, so you should get error there after you fix your current problem.
>>> d = {'Maggie': 3, 'Herman': 7, 'Betsy': 9, 'Oreo': 6, 'Moo Moo': 3, 'Milkshake': 2, ... 'Millie': 5, 'Lola': 2, 'Florence': 2, 'Henrietta': 9} >>> sorted(d) ['Betsy', 'Florence', 'Henrietta', 'Herman', 'Lola', 'Maggie', 'Milkshake', 'Millie', 'Moo Moo', 'Oreo']If you iterate over this list with for loop on row #14 and try to convert elements to int you will get error on first element ('Betsy').
I observed that on row #16 you append 'cow'. This name is not assigned, so you should get error there after you fix your current problem.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.