List swap#
Write a function swap(l, n, m)
that swaps l[n]
and l[m]
but leaves the array alone otherwise. (Remember to use a temp
variable!)
You should use assert
to make sure that l
is a list and that n
and m
are within bounds. If n == m
, you should do nothing.