def powers(n, k):
"""Compute and returns the indices numbers of n, up to and including n^k"""
b = range(k+1)
print b
a = []
for i in b:
print a
a.append(n**b)
return a
The above code is my attempt at the problem. However it returns:
TypeError: unsupported operand type(s) for ** or pow(): 'int' and 'list'
So there is some problem with the n**b part of my code.