I am making a program that is supposed to accept some arguments from a user and check those arguments to see if they satisfy the following conditions: (a) the program receives at least one argument (b) all arguments are integers (c) the arguments are either all odd OR all even (d) return False in all other situations, including the situation in which it is called with no arguments or invalid arguments
I have coded most of it, but I am getting stuck on condition (c). I was trying to add all the arguments into a list and then check to see if all inputs in the list are even or odd, but it isn't quite working. I am not sure what to from here:
def all_odd_or_even(*arguments): # the * means all or everything...
for arg in arguments:
if arg.isnumeric() == False and len(arguments) < 1 and not(len(arguments)) % 2 == 0 or not(len(arguments)) %2 != 0:
return False #returns false if these conditions are met
return True #returning true for everything else
all_odd_or_even()
If anyone can help me out, I'd really appreciate it. Please show the change in code. Thanks in advance!
(Edit): I just changed the code that I had previously, if I could get a second opinion thanks!