lundi 11 novembre 2019

Else if statement in Python

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

Aucun commentaire:

Enregistrer un commentaire