0 votes
1 view
ago in Data Science by (11.1k points)

I am trying to code if three numbers are even, odd, or neither (when the numbers have an even AND odd in the input). I'm just stuck since every time it outputs "odd" no matter the numbers. Here's my code so far:

msg = input("Enter a,b,c: ")

nums = msg.split(',')

a = int(nums[0])

b = int(nums[1])

c = int(nums[2])

if (a, b, c % 2) == 0:

    print("even")

else:

    print("odd")

I think I should use tuples but I don't know how to incorporate it. 

1 Answer

0 votes
ago by (22.5k points)

I think your professor meant something like this:

if (a % 2, b % 2, c % 2) == (0, 0, 0):

 If you want to know more about the Data Science then do check out the following Data Science which will help you in understanding Data Science from scratch

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...