Skip to content

Commit bc4b745

Browse files
committed
format all files
1 parent f4d3f5c commit bc4b745

22 files changed

+1743
-979
lines changed

Status/Day 1.md

Lines changed: 88 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
21
# Question 1
32

43
### **Question:**
54

6-
> ***Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5,
7-
between 2000 and 3200 (both included).The numbers obtained should be printed in a comma-separated sequence on a single line.***
5+
> **_Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5,
6+
> between 2000 and 3200 (both included).The numbers obtained should be printed in a comma-separated sequence on a single line._**
7+
8+
---
9+
10+
### Hints:
811

9-
--------------------------------------
10-
### Hints:
11-
> ***Consider use range(#begin, #end) method.***
12+
> **_Consider use range(#begin, #end) method._**
1213
13-
---------------------------------------
14+
---
1415

1516
**Main author's Solution: Python 2**
17+
1618
```python
1719
l=[]
1820
for i in range(2000, 3201):
@@ -21,43 +23,52 @@ for i in range(2000, 3201):
2123

2224
print ','.join(l)
2325
```
24-
----------------------------------------
26+
27+
---
2528

2629
**My Solution: Python 3**
2730
<<<<<<< HEAD
2831
=======
2932

30-
* **Using for loops**
31-
>>>>>>> 100-plus-Python-programming-exercises-extended/master
33+
- **Using for loops**
34+
> > > > > > > 100-plus-Python-programming-exercises-extended/master
35+
3236
```python
3337
for i in range(2000,3201):
3438
if i%7 == 0 and i%5!=0:
3539
print(i,end=',')
3640
print("\b")
3741
```
38-
-------------------------------
3942

40-
<<<<<<< HEAD
41-
=======
42-
* **Using generators and list comprehension**
43+
---
44+
45+
# <<<<<<< HEAD
46+
47+
- **Using generators and list comprehension**
48+
4349
```python
44-
print(*(i for i in range(2000, 3201) if i%7 == 0 and i%5 != 0), sep=",")
50+
print(*(i for i in range(2000, 3201) if i%7 == 0 and i%5 != 0), sep=",")
4551
```
4652

47-
>>>>>>> 100-plus-Python-programming-exercises-extended/master
53+
> > > > > > > 100-plus-Python-programming-exercises-extended/master
54+
4855
# Question 2
4956

5057
### **Question:**
5158

52-
> ***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
53-
Then, the output should be:40320***
59+
> **_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
60+
> Then, the output should be:40320_**
61+
62+
---
5463

55-
--------------------
5664
### Hints:
57-
>***In case of input data being supplied to the question, it should be assumed to be a console input.***
5865

59-
---------------
66+
> **_In case of input data being supplied to the question, it should be assumed to be a console input._**
67+
68+
---
69+
6070
**Main author's Solution: Python 2**
71+
6172
```python
6273
def fact(x):
6374
if x == 0:
@@ -67,58 +78,66 @@ def fact(x):
6778
x = int(raw_input())
6879
print fact(x)
6980
```
70-
------------
81+
82+
---
83+
7184
**My Solution: Python 3**
7285

73-
* **Using While Loop**
74-
```python
75-
n = int(input()) #input() function takes input as string type
76-
#int() converts it to integer type
77-
fact = 1
78-
i = 1
79-
while i <= n:
80-
fact = fact * i;
81-
i = i + 1
82-
print(fact)
83-
```
84-
* **Using For Loop**
85-
```python
86-
n = int(input()) #input() function takes input as string type
87-
#int() converts it to integer type
88-
fact = 1
89-
for i in range(1,n+1):
90-
fact = fact * i
91-
print(fact)
92-
```
93-
* **Using Lambda Function**
94-
```python
95-
# Solution by: harshraj22
96-
97-
n = int(input())
98-
def shortFact(x): return 1 if x <= 1 else x*shortFact(x-1)
99-
print(shortFact(n))
100-
101-
```
102-
-------------------
86+
- **Using While Loop**
87+
```python
88+
n = int(input()) #input() function takes input as string type
89+
#int() converts it to integer type
90+
fact = 1
91+
i = 1
92+
while i <= n:
93+
fact = fact * i;
94+
i = i + 1
95+
print(fact)
96+
```
97+
- **Using For Loop**
98+
```python
99+
n = int(input()) #input() function takes input as string type
100+
#int() converts it to integer type
101+
fact = 1
102+
for i in range(1,n+1):
103+
fact = fact * i
104+
print(fact)
105+
```
106+
- **Using Lambda Function**
107+
108+
```python
109+
# Solution by: harshraj22
110+
111+
n = int(input())
112+
def shortFact(x): return 1 if x <= 1 else x*shortFact(x-1)
113+
print(shortFact(n))
114+
115+
```
116+
117+
---
103118

104119
# Question 3
105120

106121
### **Question:**
107122

108-
>***With a given integral number n, write a program to generate a dictionary that contains (i, i x i) such that is an integral number between 1 and n (both included). and then the program should print the dictionary.Suppose the following input is supplied to the program: 8***
123+
> **_With a given integral number n, write a program to generate a dictionary that contains (i, i x i) such that is an integral number between 1 and n (both included). and then the program should print the dictionary.Suppose the following input is supplied to the program: 8_**
124+
125+
> **_Then, the output should be:_**
109126
110-
>***Then, the output should be:***
111127
```
112128
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}
113129
```
114-
------------------
115130

116-
### Hints:
117-
>***In case of input data being supplied to the question, it should be assumed to be a console input.Consider use dict()***
131+
---
132+
133+
### Hints:
134+
135+
> **_In case of input data being supplied to the question, it should be assumed to be a console input.Consider use dict()_**
118136
119-
-----------------
137+
---
120138

121139
**Main author's Solution: Python 2**
140+
122141
```python
123142
n = int(raw_input())
124143
d = dict()
@@ -128,27 +147,31 @@ print d
128147
```
129148

130149
**My Solution: Python 3:**
131-
* **Using for loop**
150+
151+
- **Using for loop**
152+
132153
```python
133154
n = int(input())
134155
ans = {}
135156
for i in range (1,n+1):
136157
ans[i] = i * i
137158
print(ans)
138159
```
139-
* **Using dictionary comprehension**
160+
161+
- **Using dictionary comprehension**
162+
140163
```python
141164
n = int(input())
142165
ans={i : i*i for i in range(1,n+1)}
143166
print(ans)
144167
```
145-
----------------------------------
146168

147-
## Conclusion
148-
***These was the solved problems of day 1. The above problems are very easy for the basic syntex learners.I have shown some easy ways of coding in my solutions. Lets see how to face and attack new problems in the next day.***
169+
---
149170

150-
[***go to next day***](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%202.md "Next Day")
171+
## Conclusion
151172

173+
**_These was the solved problems of day 1. The above problems are very easy for the basic syntex learners.I have shown some easy ways of coding in my solutions. Lets see how to face and attack new problems in the next day._**
152174

175+
[**_go to next day_**](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%202.md "Next Day")
153176

154-
[***Discussion***](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/issues/3)
177+
[**_Discussion_**](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/issues/3)

0 commit comments

Comments
 (0)