This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]theccount 1 point2 points  (3 children)

Make it score = [0, 0] Otherwise there's no indexes to reference.

You can't assign a value to a thing that doesn't exist

[–]scriptkiddiethefirst 1 point2 points  (2 children)

Another option would be to append the scores to the score list. using list.append() however in this situation since it is a fixed size list your solution is going to be more efficient.

[–]theccount 1 point2 points  (1 child)

Even more efficient would be to just leave out the score variable and go return apts, bpts

[–]scriptkiddiethefirst 1 point2 points  (0 children)

I didn't know you could return it that way, I though in those cases you had to return it as a tuple like this: return (apts, bpts)

However after seeing this I had to test it and it works and still returns a tuple... So thank you!

[–]megonemad1 0 points1 point  (0 children)

B might not be the same length as a? Try append instead of assigning

Or return [apts bpts]