0
scores = [20, 20, 20, 10, 9, 8]
if scores[0] == max(scores):
    win = (1/(scores.count(max(scores))))
    print win

I would expect this to return: 0.333

Instead it returns: 0

I put in some debugging code and confirmed that:

  • The if condition is being met. The subsequent code is being executed.

  • (scores.count(max(scores))) is returning a value of 3

So it would seem that win should obviously be set to 1/3, but it's being set to 0. I tried initializing the win variable as a float, but it made no difference.

Kaushik NP
  • 6,733
  • 9
  • 31
  • 60
Justin
  • 13
  • 4

0 Answers0