0

def print even?

whenever i hit run for this code I get no none how do i get rid of the none underneath no def even (x): if x % 2 == 0: print ("yes") else: print ("no") print (even(5)) no none

21st May 2020, 9:47 PM
Jah Revelo
Jah Revelo - avatar
3 Antworten
+ 3
change "print(even(5))" to "even(5)"
21st May 2020, 9:56 PM
4lx
4lx - avatar
+ 2
Your code does not return any value, to solve it do what I×Am×Idiot says, I recommend the following way: def even (x):      return "yes" if x%2 == 0 else "no"          print (even (4)) print (even(5))
21st May 2020, 10:12 PM
CoffeeByte
CoffeeByte - avatar
0
ty so much
21st May 2020, 9:58 PM
Jah Revelo
Jah Revelo - avatar