+ 2
Python factorial using function, this program doesn't work what is the problem?? Please answer
def fact(n): f=1 for I in range(n): f=f*(I +1) return f num=int(input("enter a num") r=fact(num) print(r) It shows error in 7 line of code https://code.sololearn.com/cdmc03uEDFjw/?ref=app r=fact (num) Syntax Error:invalid syntax( r=fact (num)) in this line
11 Respuestas
+ 2
AAYUSH AGARWAL Nice! The problem is unbalanced parenthesis in the previous line (the one with input). The input call parenthesis are closed, but the int one are not.
+ 1
Emerson Prado now check I give full information about that particular code which need to solve or find error in that for you
+ 1
Emerson Prado thanks alot
+ 1
Emerson Prado nice meet with you
0
AAYUSH AGARWAL Pls note this section is intended for questions about programming only. For you to showcase code, pls use your feed.
0
Emerson prado i ask answer ok
0
AAYUSH AGARWAL Ah, OK.
Pls elaborate on "doesn't work". Explain - still in the question description - what is unsatisfying in the results.
This is a general advice: the better you explain your problem, the better help you get.
0
AAYUSH AGARWAL After that, while you wait for answers, pls review range function. Specially, how it interprets the parameter(s).
0
Emerson Prado I explain it now so please give answer
0
AAYUSH AGARWAL Pls paste the error message. The error strings have a meaning, and they are key to find the problem.
Always give the full information. This helps you to get better help.
0
Emerson Prado ok