← Back to Community
##### Help needed
Profile icon
FARHEENPALAGIRI

Hey everyone, it's me. Again. And, as usual, I am an idiot and can't figure out how to write this code. Help me please?

Okay so I'm writing this code where the user will input the amount of numbers they'd be inputting plus all the numbers, and the code will add all the numbers. The amount of numbers can vary. So, I wrote this:

N = int(input())

for i in range(N):
y = (i ** 3)
total = sum(y)
print(total)

This, however, will not work. Can someone please look at this?? Thank you.

Answered by HappyFakeboulde [earned 5 cycles]
View Answer
Voters
Profile icon
TopZek
Profile icon
Brandaboss
Profile icon
FARHEENPALAGIRI
##### Comments
hotnewtop
Profile icon
HappyFakeboulde

can you please give a link to the repl instead of pasting in the code?

Profile icon
FARHEENPALAGIRI
Profile icon
Brandaboss

This works for me:

N = int(input("Amount of numbers: "))
total = 0
for i in range(N):
numb = int(input("Number "+str(i+1)+": "))
total += numb
print(total)

Tell me if it helps.

Profile icon
FARHEENPALAGIRI

@Brandaboss Thank you

Profile icon
TopZek

I think you should send HappyFakeboulde the multiplayer link ; copy the code down first if he accidentally erases it.

Profile icon
FARHEENPALAGIRI

@TopZek Sure

Profile icon
HappyFakeboulde

@TopZek or if i purposefully erase it