View Single Post
Old 11-01-2019, 04:14 AM   #1
kylecarroll
Junior Member
kylecarroll began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Oct 2019
Device: Kindle
Division fails when using an int variable

I'm trying to get an average rating in my plugin and I keep getting a 'divide by zero' error when I do this:

Code:
 top = int(sum(rateList))
            bottom = int(len(rateList))
            averageRating = top/bottom
However, if I change the "/" to any other mathematical symbol, it works as expected. Additionally, if I remove the variables and use plain int values, it works fine. Is this a bug, or am I doing something wrong?
kylecarroll is offline   Reply With Quote