lundi 22 mai 2017

Why does calling the variable in this if statement give me a syntax error. What rule am I missing here?

I am using python 3. I'm trying to understand why this code gives me a syntax error on my third line where it says "If not n % 2 == 0". I think there is some rule I am missing. What I'm trying to is impose some conditions on an inputted integer to give me a specific output.

n = int(input().strip()) 

def find_weird(n):
If not n % 2 == 0:
return "Weird"

Elif n % 2 == 0 and N < 5 and N > 2:
return "Not Weird"

Elif n % 2 == 0 and N < 20 and N > 6:
return "Weird"

Elif n % 2 == 0 and N > 20:
return "Not Weird"

Aucun commentaire:

Enregistrer un commentaire