The function merges two lists of the same length, the first of strings, the second of integers.
The function is:
def switchlist(n,m):
f=[]
z = range(0,len(m))
for k in z:
f.append(n[k])
f.append(m[k])
return f
The list is correct, except that it returns: ['yes', 2, 'always', 4]
, instead of:
[('yes', 2), ('always', 4)]
(if those are the two strings and the two integers)
Does anybody know how to fix the brackets?