Question

I'm trying to run the code in Python below and keep getting invalid syntax. What's wrong?...

I'm trying to run the code in Python below and keep getting invalid syntax. What's wrong? Thanks for any help!

def even(n):
if n%2==0

#Enter a Number


def main():
n=int(input("Enter a number: "))

#If even print "Number is even"

if(even(n)):
print("The number is even")

#If odd print "Number is odd"

else:
print("The number is odd")

main() #Call the main function

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def even(n):
    if n%2==0:
        return True
    else:
        return False
        
        
#Enter a Number
def main():
    n=int(input("Enter a number: "))
    #If even print "Number is even"
    if(even(n)):
        print("The number is even")
    #If odd print "Number is odd"
    else:
        print("The number is odd")

main() #Call the main function

Add a comment
Know the answer?
Add Answer to:
I'm trying to run the code in Python below and keep getting invalid syntax. What's wrong?...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT