I'm trying to write function map() getting error IndexError: list index out of range
def map1(fn, a):
i = 0
b = []
while i != len(a):
print(len(a))
i += 1
b.append(fn(a[i]))
return b
with working function
def translate(x):
dicti = {"merry": "god", "christmas": "jul", "and": "och", "happy": "gott", "new": "nytt", "year": "år"}
return dicti[x]
got the error
IndexError: list index out of range
IndexErrorso that it is possible to see where it occurs. What are the arguments tomap1()that produce the error?