0

I am trying to compute the factorial of n using for loop and an accumulator. I am having trouble with the range command and its two parameters - start and end. I am getting invalid syntax error. Here's the code:

# factorial.py
#   Program to compute the factorial of a number
#   Illustrates for loop with an accumulator

def main():

    n = int(input("Please enter a whole number: "))

    fact = 1

    for factor in range(1, (n + 1))
        fact = fact * factor

    print("The factorial of", n, "is", fact)


main()

Where's the problem?

I am using Python 3.6.

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
wraith46
  • 305
  • 1
  • 6
  • 17

1 Answers1

0

You simply forgot a : after your range function since it is a for loop ^.^

Jordan Pagni
  • 454
  • 3
  • 11