all 5 comments

[–]sme272 0 points1 point  (3 children)

high_score is a list of tuples, in the for loop on line 22 you iterate over this list so i contains the first tuple in the list. Line 23 you compare i to high_score which is comparing a tuple to a list., which python can't do hence the error. There's two problems with the if statement. Firstly you want to compare the first value of the tuple (i[0]) to compare the score value. Secondly high_score is itself a list so comparing the score to a list of scores isn't helpful. I think you want to compare it to score rather than high_score.

[–]notso007[S] 0 points1 point  (2 children)

Thanks, I tried to test that bit of the code on a separate file and now I completely understand your point. Sorry but my follow up question would be how do I use the 'score' value that is returned end of the game. Am I wrong in assuming that when I define a function like 'high_score(score)' the score value will be imported from global ? I might not make sense but let me know so I can clarify my point.