repl.it
@sclanc20/

4.5. For: Sum of cubes

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
Instructions from your teacher:
Statement

For the given integer N calculate the following sum:

1³ + 2³ + ... + N³


Example input

3


Example output

36
"""
#Program
N=int(input("Enter the number:"))
X=[]
for i in range(1,N+1):
  Y=i**3
  X.append(Y)
print(sum(X))
Fetching token
?