Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help! Error
#5
What if tosumup[i] = [0, 0, 0] ? Then zeros[i] would be 3 i suppose (you don't mention how it is filled). And then the if statement would execute the next line. Which would raise the error you got.
So it is best to always test exactly what you need to check, namely: (len(tosumup[i]) - (zeros[i])) must not be 0.
if (len(tosumup[i]) - (zeros[i])) != 0:
    a = sums[i]/(len(tosumup[i]) - (zeros[i]))
else
    a = None  # I think you need to match the indexes later, so you should add someting.
avareges.append(a)
Reply


Messages In This Thread
Help! Error - by bwdu - May-22-2020, 12:16 PM
RE: Help! Error - by Yoriz - May-22-2020, 12:24 PM
RE: Help! Error - by Larz60+ - May-22-2020, 12:27 PM
RE: Help! Error - by bwdu - May-22-2020, 12:47 PM
RE: Help! Error - by ibreeden - May-22-2020, 04:58 PM
RE: Help! Error - by deanhystad - May-22-2020, 05:38 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020