You created empty list. Therefore index is out of range:
You also ask two times for input for both a and b.
One way of writing this code:
>>> luck = list() >>> len(luck) 0 >>> luck[0] /..../ IndexError: list index out of rangeYou should use append.
You also ask two times for input for both a and b.
One way of writing this code:
>>> a = int(input("Give number a: ")) >>> b = int(input("Give number b: ")) >>> luck = list() for i in range(b): ... luck.append(a**b)Of course, if task is [a^0,a^1,a^2,...,a^b] then one should append (a**i)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.