There are many uses of %, it is used in string formatting operations like %= to substitute values into a string also it is used to evaluate remainder and mod:
Below is the example regarding that:-
x = 'abc_%(key)s_'
x %= {'key':'value'}
print(x)
'abc_value_'
In your case, 4%2 is 0 because when you divide 4 by 2 it will give remainder as 0.
To know more about this you can have a look at the following video tutorial:-