I found a fluke in passing the lesson?

I’m puzzled. The browser lets me pass with the following code (very similar to those posted above):

def lots_of_math(a, b, c, d):
  first = a+b
  print(first)
  second = d-c
  print (second)
  third = first*second
  print (third)  
  fourth = third % a
  return fourth

But this code returns only positive numbers:
3
1
3
0
2
0
0
0

Unlike what is expected according to the comments: 3, -1, -3, 0 and 2, 0, 0, 0.

What should I do different? Or are the instructions wrong?

3 + -1  ==  2  (first)

0 - -3  ==  3  (second)  ##

2 * 3   ==  6  (third)

6 % 3   ==  0  (fourth)

## Remember that `minus minus` is `plus`.
1 Like

Thanks, mtf. I’m aware of the basic math rules. And that’s why I was puzzled: I just couldn’t figure out how my code produced different answers if it was essentially the same as everyone elses, and the browser let me pass (green light). I now noticed, however, that I had inverted the order between d and c in the second variable (should be c minus d, and not d minus c). So problem solved anyway :slight_smile:

Your replies in the forum have been very helpful over several Codecademy courses, thanks for taking the time!

2 Likes