+ 1

Help plis

1. def is_even(x): 2. if x == 0: 3. return True 4. else: 5.return is_odd(x-1) 6. def is_odd(x): 7. return not is_even(x) print(is_odd(17)) print(is_even(23)) here what is return not in line 7

6th Aug 2017, 7:34 PM
stephen haokip
stephen haokip - avatar
1 ответ
+ 2
not is a keyword in Python that negates a boolean value, usually is ! in other languages e.g. !true is false
6th Aug 2017, 7:51 PM
Dan Walker
Dan Walker - avatar