Sorry, new to python in general. I'm making a code which separates a even,odd numbers from a num_list and even numbers would be sorted by highest to lowest. I'm keep getting "unsupported operated type" error message. Is there a way to use % with list?
num_list = [2,10,2,3,4,8,11]
odd_num = []
even_num = []
def number_seperator(*args):
for i in args:
if i % 2 == 0:
return even_num.append(i)
else:
return odd_num.append(i)
return
print(max(number_seperator(num_list)))
print(even_num)
print(odd_num)
You cannot take the modulus of a list.
You are currently trying to execute
Decide whether you want to accept a single list parameter, or accept multiple int arguments. Them either delete the
*in thedefor add one to the method call.