+ 1
# a list comprehension cubes = [ for i in range(5) i**3] print(cubes) why is it not possible
2 odpowiedzi
+ 1
It is possible, but with the right syntax.
Try:
cubes = [ i ** 3 for i in range(5) ]
0
cubes = [i**3 for i in range(5)]
print(cubes)
it is possible when written that way