Another problem, why does modulo return `None`

rather than 0? Is there a way to convert `None`

to 0?

Can you give an example? If you do `3%3`

, it should return `0`

.

```
# Write your lots_of_math function here:
def lots_of_math(a, b, c, d):
print(str(a + b))
print(str(d - c))
print(str((a + b) * (d - c)))
print(str(((a + b) * (d - c)) % a))
# Uncomment these function calls to test your lots_of_math function:
print(lots_of_math(1, 2, 3, 4))
# should print 3, -1, -3, 0
print(lots_of_math(1, 1, 1, 1))
# should print 2, 0, 0, 0
```

```
3
1
3
0
None
2
0
0
0
None
```

I just noticed that the 0 is there, but I don’t know why there is a “None”

The reason `None`

appears at the end is because your `lots_of_math`

function does have any `return`

value, so it is automatically given the value of `None`

. Then, when you print the function:

```
print(lots_of_math(1, 1, 1, 1))
```

It gets called-so all of the `print`

statements inside it print, and then you print the return value. Which is `None`

.

5 Likes

Ah ok I understand now.

1 Like

I guess it was irresponsible of me to just put this on my previous post. Sorry about that.

1 Like