Need some help for assignment today | SoloLearn: Learn to code for FREE!

+6

# Need some help for assignment today

How to calculate the Factorial: Sample output: 0! = 1 1! = 1 2! = 1 3! = 1 . . n! = 1 * 2 * 2 * 3 * 2 * 3 * ... n-1 * n Please enter a number: 5 5! = 120 My attempt: # Write your code def factoRecurs(numb): if numb ==1: return 1 else: print(numb) return numb * factorRecurs(numb-1) inpNum = int (input(“Enter a number”)) if inpNum >= 1: print(“the factorial ”)

5/11/2020 9:58:20 AM

Allll

+14

You can use a loop, a recursive function and a few other ways. Try to figure out your own solution, only practice makes you a programmer. If you can't get it to run, you can link your attempt here, we'll try to help you with a hint instead of the answer.

+8

A simple way is also to use a for loop with a range object.

+7

I need some Game developers friends... For help each other.. Anyone here .. who learn java ...

+3

Try this code... print((lambda x: 1 if x==0 else __import__('functools').reduce(lambda a,b:a*b, [i for i in range(1, x+1)])) (int(input())))

+3

use a for loop with a range object

+1

Allll Never forget to mention your programming language & Show us your attempt, we do not provide answer directly

+1

i will try my best

+1

i will thanks

+1

Try this one..... def fact(x): a=1 for i in range (1,x): a*=i print('Factorial of',num,'is',a) num=int(input('Enter a number:')) if num==0: print('Factorial of',num,'is 1') elif num>0: fact(num+1) else: print('Invalid Entry')

+1

https://code.sololearn.com/clx3S2dXACID/?ref=app You can have a look at this

+1

n=int(input()) f=1 if (n==0): print("1") elif(n>0): while(n!=0): f=f*n n-=1 print(f)

0

Allll you can use recursion to find your factorial

0

Your samples.are you sure, they are correct?

0

yeah i copy it from the assignment

0

this is the question Write a function that accepts n as a parameter and calculate its factorial (n!) and return its result.

0

Allll Hints are provided to you make a snippet and link it here

0

https://www.sololearn.com/post/394212/?ref=app

0

Allll what's the problem, have you started making the code for your assignment

0

Frankly, I can not find a solution

0

and i need to solve it to pass