0

This is what the program wants me to output

Give a number: 10 Give another number: 11 One of the numbers is even.

Give a number: 12 Give another number: 20 Both numbers are even.

Give a number: 15 Give another number: 21 Both numbers are odd.

Here is what I tried to do

number1 = int(input("Give a number:"))
number2 = int(input("Give another number:"))
if (number1 % 2 == 0) or (number2 % 2 ==0):
        print("One of the numbers is even.")
elif (number1 % 2 != 0) or (number2 % 2 !=0):
            print("One of the numbers is odd)

But the program said I have a syntax error *Edit: I tried programming this but it doesn't give out the output I want

1
  • Please provide the full error message, it will likely tell you exactly where the problem is Commented Nov 11, 2019 at 16:34

2 Answers 2

2

You forgot one " at the last print ;)

number1 = int(input("Give a number:"))
number2 = int(input("Give another number:"))
if (number1 % 2 == 0) or (number2 % 2 ==0):
        print("One of the numbers is even.")
elif (number1 % 2 != 0) or (number2 % 2 !=0):
            print("One of the numbers is odd")

input: 1 & 10 output: One of the numbers is even.

Sign up to request clarification or add additional context in comments.

Comments

1

There is a " missing in your last print statement.

It should be: print("One of the numbers is odd")

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.