Thursday 27 April 2017

Simple math in python won't work?

I just started learning python, and I wrote these three lines of code:




points = 49
total = points / 50 * 500 + 40
print "omg wtf ", total


And I expected the output to be something like 530, but instead, no matter what I do, I keep getting 40. I tried initializing total to 0, casting the assignment to an int, I threw in a buttload of parentheses, but nothing works. I'm so baffled... Can someone help me / tell me what the heck is going on?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...