Write a program which can compute the factorial of a given number.
Suppose the following input is supplied to the program:
4
Then, the output should be:
24
Hints:
In case of input data being supplied to the question, it should be assumed to be a console input.
👇🏻
💡Concept of Factorial
- Factorial of 5 = 1 x 2 x 3 x 4 x 5 = 120
- Factorial of 0 = 1
- Factorial of 1 = 1
- Factorial of 2 = 1 x 2 = 2
- Factorial of -1 = Does not exist
👇🏻
✅Steps to Solve
1. Take the input and convert it to int data type 2. Check if the value is negative then the factorial does not exist 3. Check if the value is equal to zero, if true then return 1
👇🏻
4. use for loop to perform reverse iteration, to multiply values in decreasing order 5. return the result 6. call the function to test the output
Steps to solve: 1. take input from the user and convert it to an integer 2. then initialize a dictionary "result" 3. now use for loop to fill the dictionary with 'i' as key and i*i as value 4. print the dictionary
You run analytics on data to gain insights. These insights are meaningless until you reveal the story they wish to tell. These insights must translate into actions or business results.
People get moved by stories, not facts. I'm sure you recall certain stories from your youth. Stories inspire action. Will listening to a story about Mahatma Gandhi motivate you to take action?
There are two types of businesses: 1. service-based (TCS, WIPRO, INFOSYS, Cognizant, and Capgemini) 2. product-based (TCS, WIPRO, INFOSYS, Cognizant, and Capgemini) (Microsoft, Apple, Google, and Tesla).
👇🏻
Product-based companies grant data science projects to service-based companies.
While product-based businesses, receive data science projects from the various departments that make up their organization
- such as sales, logistics, manufacturing, and so on.