Im getting this error lyk INVALID SYNTAX:


n =int(raw_input("Enter the no for factorial:")
def factorial(n):
#n = int(raw_input("Enter the no for factorial:")
if n>0:
fact = n
print"Enter a positive Number:"
while n > 1:
n -= 1
fact =fact*n
return fact
print fact

im jst trying to give user input for this program..
it works fine when it is not declared with the raw_input.
could anyone tell about it .
it ll b gratefull ...
thnxxxx in advance :grinning:


@jhonyl ,

Make sure that all your opening parentheses are matched by closing parentheses. For example, you have this:

n =int(raw_input("Enter the no for factorial:")

The closing parentheses that should match the opening parenthesis for the int function is missing.

Check the remainder of your code for the same problem.

Since your posted code in not formatted, we cannot check its indentation, making it difficult for other users to read and debug it. After code has been pasted into the editing window for posting, you can format it by selecting it, and then by clicking the </> button above the editing area. This will enable us to see important details, such as the indentation and underscores.


ok i ll do it again.thank u for ur explanation