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
上記のコードは、問題に対する私の試みです。ただし、次のように返されます。
TypeError: unsupported operand type(s) for ** or pow(): 'int' and 'list'
したがって、コードの n**b 部分に問題があります。