def odds_and_evens(arglist):
evens = []
odds = []
for i in range(len(arglist)):
ith_element = arglist[i]
if i % 2 == 0:
evens.append(ith_element)
else:
odds.append(ith_element)
assert ith_element_is_in_correct_list(arglist, i, evens, odds)
return (evens,odds)
Write a function ith_element_is_in_correct_list(arglist, i, evens, odds)
that will be called by the assert at the end of each iteration
of the loop shown above. The purpose of this function is to check that the
ith element has been inserted into the right one of
the two lists odds and evens.
Your function ith_element_is_in_correct_list(arglist, i, evens, odds)
should behave as follows. Given: