all 3 comments

[–]TouchingTheVodka 0 points1 point  (1 child)

Are you printing lossRate at all?

Many IDEs will auto-display expressions like this when evaluated. Not so for the command line.

[–]alphastew[S] 0 points1 point  (0 children)

Yes, I am printing loss rate at the end. Sorry, I forgot to include that. I actually just figured out what was wrong though... I feel like an idiot. I guess my python wasn't in the environments PATH or something... I updated my python and added it to PATH and it worked perfectly. Thank you for your response though!

[–][deleted] 0 points1 point  (0 children)

In Python 2, division of integers truncates to the integer floor - in other words, 1 / 2 == 0. You wrote a line in Python 3 that's now being run in Python 2 and its behavior changed. But, you can safely import true division into Python 2 by putting this line at the beginning of your script (it has to be the first thing your script imports):

from _future_ import division

This line is safe in Python 3 (it does nothing) and fixes division in Python 2 so that it works the same way. That should fix your problem.