Write a script that prints the first 10 cube numbers (x**3), starting with x=1 and ending with x=10.
Answers
Answered by
17
cubes = [ x ]
for number in range(1, 11):
cube = number**3
cubes.append(cube)
for cube in cubes:
print(cube)
start x = 1 ; end x=10.
starting with x=1 and ending with x=10.
- 1³ = 1
- 2³ = 8
- 3³ = 27
- 4³ = 64
- 5³ = 125
- 6³ = 216
- 7³ = 343
- 8³ = 512
- 9³ = 729
- 10³ = 1000
___________________________________
Other method :-
cubes = [number**3 for number in range(1,10)]
for cube in cubes:
print(cube); x
start x = 1 ; end x=10.
starting with x=1 and ending with x=10.
- 1³ = 1
- 2³ = 8
- 3³ = 27
- 4³ = 64
- 5³ = 125
- 6³ = 216
- 7³ = 343
- 8³ = 512
- 9³ = 729
- 10³ = 1000
__________________________________
Similar questions