what would is_even(4) be? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what would is_even(4) be?

what would is_even(4) be? def is_even(x): if x % 2 == 0: print('even') print('odd') return x-1

12th Jan 2017, 2:32 AM
Andrew Rivera
Andrew Rivera - avatar
2 Answers
+ 7
It would print 'even'.
12th Jan 2017, 4:52 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
it would print even but it would also print odd since odd is outside the if condition so whenever they function is called it will print odd no matter what
10th Apr 2017, 11:23 AM
Tejas Bhatt
Tejas Bhatt - avatar