0

help!

what's the meaning of "return not is_even(x)"

14th Aug 2020, 12:50 AM
沈绍宁
3 Respostas
+ 5
Without the code nobody can tell you. I can just guess based on the names, what I would expect from that. is_even seems to be a method, which returns a boolean value, if the given parameter 'x' is an even number or not. The operator 'not' inverts this result, so that this code snippet should return a boolean indicator, if 'x' is an odd number.
14th Aug 2020, 12:58 AM
Sandra Meyer
Sandra Meyer - avatar
+ 2
#something like this? def is_even(num): return num%2==0 print(is_even(4)) print(is_even(5)) print(not is_even(4)) print(not is_even(5))
14th Aug 2020, 1:01 AM
Steven M
Steven M - avatar
0
thank you, Steven M, Sandra Meyer!!! I turn back to the code and understand it.
14th Aug 2020, 6:33 AM
沈绍宁