Domanda

def is_even(answer):
    answered = X % 2 ==0
    if answer ==  answered:
        return "yep"
    else:
        return "nope"

the instructions are: Write a function called is_even that takes one input, x, and returns the string "yep" if the input is even and "nope" otherwise. You do not need to call the function.

È stato utile?

Soluzione

It's most likely a compile error, as you never introduce X. Also, you should read the instructions again. It clearly says what the input should be (x). So the method should start like the following:

def is_even(x):
  if ...:
    return "yep"
  else:
    return "nope"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top