can I check if anyone able to give advise for my coding below?
I am trying to achieve if I can enter 2 integers and the program will reads if e.g 2 and 2 is even then 3 and 3 is odd, lastly if 2 and 3 it will print one is even the other is odd..
def q6():
num1 = int(input("Enter One Number: "))
num2 = int(input("Enter Second Number: "))
if (num1 % 2) == 0:
if (num2 % 2) == 0:
print("The Numbers are Even")
else:
print("One Number is Even and the other is Odd")
else:
print("The Numbers are Odd")
q6()
Output 1: Enter One Number: 2 Enter Second Number: 5 One Number is Even and the other is Odd
Output 2: Enter One Number: 2 Enter Second Number: 2 The Numbers are Even
Output 3: Enter One Number: 3 Enter Second Number: 3 The Numbers are Odd
Output 4: Enter One Number: 5 Enter Second Number: 16 The Numbers are Odd
It seems to working, but under Output 4 it suppose to be "One Number is Even the other is Odd" but it doesn't work very well seems I am missing of something.. Anyone can advise please..
Aucun commentaire:
Enregistrer un commentaire