题目
方法:
def iq_test(numbers):
#your code here
num=numbers.split(" ")
a=[]
b=[]
i=0
#遍历
for i in num:
if int(i)%2 != 0:
a.append(i)
else:
b.append(i)
if len(a)>len(b):
aa=''.join(b)
return num.index(aa)+1
else:
bb=''.join(a)
return num.index(bb)+1
结论:该题运用了遍历,奇偶判断,索引