I have created a range list - [2, 4, 6, 8, 10]
RangeList = list(range(2,11,2))
RangeList
[2, 4, 6, 8, 10]
I need to convert this list into [8, 64, 216, 512, 1000] The criteria i am working with:
-use a for loop and the 'cubed' function defined to convert the above list to
-[8, 64, 216, 512, 1000]
def cubed(x):
y = x**3
print(' %s'%(y))
return(y)
for x in RangeList:
cubed(x)
8
64
216
512
1000
What am i missing in my code to get this to present as a straight list with commas.