the error "invalid literal for int() with base 10:" keeps coming up

Posted by ratce003 on Stack Overflow See other posts from Stack Overflow or by ratce003
Published on 2010-04-12T10:18:27Z Indexed on 2010/04/12 10:23 UTC
Read the original article Hit count: 299

Filed under:
|

I'm trying to write a very simple program, I want to print out the sum of all the multiples of 3 and 5 below 100, but, an error keeps accuring, saying "invalid literal for int() with base 10:" my program is as follows:

sum = ""
sum_int = int(sum)
for i in range(1, 101):
    if i % 5 == 0:
        sum += i 
    elif i % 3 == 0:
        sum += i
    else:
        sum += ""

print sum

Any help would be much appreciated.

© Stack Overflow or respective owner

Related posts about python

Related posts about error