0

I have make a factorial programe that is

def factorial(x): x=int(input("enter first no")) fact=1 for i in range(1,x): fact=fact*i return fact z=factorial(x) print("the factorial ",z) the error was:- 'return' is outside

19th Jul 2018, 12:28 PM
Harsh Mamgai
Harsh Mamgai - avatar
14 Respuestas
+ 2
see the code again. i changed it a bit.
19th Jul 2018, 12:56 PM
Satyam
19th Jul 2018, 12:44 PM
Satyam
+ 2
Your for loop is indented wrongly.
19th Jul 2018, 12:48 PM
Satyam
+ 2
you're welcome.
19th Jul 2018, 12:58 PM
Satyam
+ 1
to the function? it is not necessary in this case.
19th Jul 2018, 12:54 PM
Satyam
+ 1
got to my other answer with the code.
19th Jul 2018, 12:57 PM
Satyam
+ 1
Arguments are used to pass information to a function. Otherwise, they are unnecessary.
19th Jul 2018, 1:11 PM
Satyam
0
bro I want to make it by for loop
19th Jul 2018, 12:47 PM
Harsh Mamgai
Harsh Mamgai - avatar
0
s.c. I want to ask one question why have we given any argument to for for loop
19th Jul 2018, 12:50 PM
Harsh Mamgai
Harsh Mamgai - avatar
0
bro tell me why you have not given any argument to for loop plz
19th Jul 2018, 12:53 PM
Harsh Mamgai
Harsh Mamgai - avatar
0
can we make it with arguments
19th Jul 2018, 12:55 PM
Harsh Mamgai
Harsh Mamgai - avatar
0
send me
19th Jul 2018, 12:57 PM
Harsh Mamgai
Harsh Mamgai - avatar
0
thnx bro
19th Jul 2018, 12:58 PM
Harsh Mamgai
Harsh Mamgai - avatar