Mar-24-2019, 02:49 PM
(This post was last modified: Mar-24-2019, 02:49 PM by erfanakbari1.)
Hello guys !
I just got an exercise to do and I wrote some code for this task but unfortunately I'm facing some errors !
The task is :
and this is my code and functions for doing it
Thanks
I just got an exercise to do and I wrote some code for this task but unfortunately I'm facing some errors !
The task is :
# to write methods that return the highest score from the list, the last added score and the three highest # scores.I solved the first ones ( return highest score and the last added score successfully . ) but I got stuck in last one which is to return the three highest scores
and this is my code and functions for doing it
def Three_highest_scores(a, b, c): for j in gamePlayersList: a = max(gamePlayersList) print(j) return a for f in gamePlayersList: if f < a: b = max(f) print(f) return b for x in gamePlayersList: if a > x < f: c = max(x) print(x) return c Three_highest_scores(max(gamePlayersList), max(f), max(x)) print(Three_highest_scores())And this is the error :
Three_highest_scores(max(gamePlayersList), max(f), max(x)) NameError: name 'f' is not definedSo , I'm very thankful if you can help me fix these issues .
Thanks