Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Day 1.md #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions Status/Day 1.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ print(*(i for i in range(2000, 3201) if i%7 == 0 and i%5 != 0), sep=",")

### **Question:**

> **_Write a program which can compute the factorial of a given numbers.The results should be printed in a comma-separated sequence on a single line.Suppose the following input is supplied to the program: 8
> **_Write a program which can compute the factorial of a given number. Suppose the following input is supplied to the program: 8
> Then, the output should be:40320_**

---
Expand Down Expand Up @@ -93,7 +93,7 @@ print fact(x)
fact = fact * i
print(fact)
```
- **Using Lambda Function**
- **Using a Function**

```python
# Solution by: harshraj22
Expand Down Expand Up @@ -136,6 +136,20 @@ print(reduce(fun,range(1, num+1), 1))
```
---

- **Using Lambda Function and Reduce**
```python
'''Soltuion by: go1337
'''
from functools import reduce

input_nr = int(input("Enter number to get its factorial: "))

factorial = reduce(lambda x, y: x * y, range(1, input_nr + 1))
print(factorial)
```
---


# Question 3

### **Question:**
Expand Down