Why python program is not running?

Project Euler: Problem 1: Multiples of 3 and 5
So did this code. But no test are running an it says syntax error. Why?

def multiplesOf3and5(n):
sum = 0
for x in range(1, n, 1):
    if (x%3) == 0 or (x%5) == 0:
        sum += x
return sum
multiplesOf3and5(49)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.

Challenge: Problem 1: Multiples of 3 and 5

Link to the challenge:

your function has nothing inside, look at your indentation, to put stuff inside the function you need to indent those lines

In my first question the code’s wrong indentation was my fault due to bad copy. Here is my original code:

def multiplesOf3and5(n):
    sum = 0
    for x in range(1, n, 1):
        if (x%3) == 0 or (x%5) == 0:
            sum += x
    return sum
multiplesOf3and5(49)

As for the error, it says:

SyntaxError: unknown: Unexpected token, expected ";" (1:4)


> 1 | def multiplesOf3and5(n):
    |     ^
  2 |   sum = 0
  3 |   for x in range(1, n, 1):
  4 |     if (x%3) == 0 or (x%5) == 0:

If you are trying to pass this challenge with Python code, it will not work. These challenges require you to use JavaScript.

1 Like

Oh! I didn’t know that since I am new in freecodecamp.