Does anybody know how to convert this javascript function to python ?
javascript:
function ding(t, a, e, n) {
return t > a && t <= e && (t += n % (e - a)) > e && (t = t - e + a), t
}
This is my try on doing so:
def ding(t, a, e, n):
return t > a and t <= e and (t + n % (e - a)) > e and (t = (t - e + a)), t
It returns a syntax error at the "=" in (t = (t - e + a)) and idk how to solve this right.
When giving it these values: ding(53, 47, 57, 97) it should return 50 in the original javascript function.
:=to use an assignment in an expression.ifsyntax instead of ternary. Then it will be easier to see how to convert it to Python.t := (t - e + a), but it still returns a bad value 43, it should return 50