Skip to content

Commit 8774777

Browse files
committed
commit all
2 parents b8e537c + 19102f7 commit 8774777

21 files changed

+1340
-603
lines changed

README.md

Lines changed: 67 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,79 @@
22
---------------------
33
## Introduction
44

5-
***The excersise text contents of this repository was collected from github account of [zhiwehu](https://github.com/zhiwehu/Python-programming-exercises).I collected it to practice and solve all the listed problems with python.As I was learning python in this running timeline ,I hope this 100+ excercise will help me a lot to get my hands free with python.***
5+
***The exercise text contents of this repository was collected from GitHub account of [zhiwehu](https://github.com/zhiwehu/Python-programming-exercises). I collected it to practice and solve all the listed problems with python. Even after these collected problems are all set up, I will try to add more problems in near future. If you are a very beginner with python then I hope this 100+ exercise will help you a lot to get your hands free with python.***
66

7-
***In this repository, I will be updating my regular status and activities of the given problems with my own solution.Also, I will be explaining the code and tell my oppinion about the problem if needed. Main Authors solutions are in python 2 & my solutions will be in python 3***
7+
***One will find the given problems very simple and easy to understand. A beginner can try 3-5 problems a day which will take a little time to solve but definitely will learn a couple of new stuff (no matter how lazy you are :P ). And after regular practice of only a month, one can find himself solved more than 100++ problems which are obviously not a deniable achievement.***
88

9+
***In this repository, I will be gradually updating the codebase of the given problems with my own solutions. Also, I may try to explain the code and tell my opinion about the problem if needed. Main Authors solutions are in python 2 & my solutions will be in python 3. Every problem is divided into a template format which is discussed below. There is a [discussion](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/issues/3) section so don't forget to share your opinion, ideas and feel free to discuss anything wrong or mistake***
910

10-
## 100+ Python challenging programming exercises
11-
### 1. Level description
11+
----------------
1212

13-
- **Level 1:** *Beginner means someone who has just gone through an introductory Python course. He can solve some problems with 1 or 2 Python classes or functions. Normally, the answers could directly be found in the textbooks*
13+
# 100+ Python challenging programming exercises
1414

15-
- **Level 2:** *Intermediate means someone who has just learned Python, but already has a relatively strong programming background from before. He should be able to solve problems which may involve 3 or 3 Python classes or functions. The answers cannot be directly be found in the textbooks.*
1615

17-
- **Level 3:** *Advanced. He should use Python to solve more complex problem using more rich libraries functions and data structures and algorithms. He is supposed to solve the problem using several Python standard packages and advanced techniques.*
16+
## 1. Problem Template
1817

19-
### 2. Problem template
20-
21-
* *Question*
22-
* *Hints*
23-
* *Solution*
18+
* ***Question***
19+
* ***Hints***
20+
* ***Solution***
2421

2522
-----------------
26-
## Starting date: 3rd January 2018
27-
28-
* **Practice Status**
29-
1. **[Day 1](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%201.md "Day 1 Status")**- Question 1,2,3
30-
2. **[Day 2](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%202.md "Day 2 Status")**- Question 4,5,6,7,8,9
31-
3. **[Day 3](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%203.md "Day 3 Status")**- Question 10,11,12,13
32-
4. **[Day 4](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%204.md "Day 4 Status")**- Question 14,15
33-
5. **[Day 5](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%205.md "Day 5 Status")**- Question 16,17
34-
6. **[Day 6](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%206.md "Day 6 Status")**- Question 18,19
35-
7. **[Day 7](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%207.md "Day 7 Status")**- Question 20,21
36-
8. **[Day 8](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%208.md "Day 8 Status")**- Question 22,23,24,25
37-
9. **[Day 9](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%209.md "Day 9 Status")**- Question 26,27,28,29,30
38-
10. **[Day 10](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_10.md "Day 10 Status")**- Question 31,32,33,34,35,36,37
39-
11. **[Day 11](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_11.md "Day 11 Status")**- Question 38,39,40,41,42,43
23+
24+
## 2. Practice Status
25+
26+
* **[Day 1](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%201.md "Day 1 Status")**- ***Question 1-3***
27+
28+
* **[Day 2](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%202.md "Day 2 Status")**- ***Question 4-9***
29+
30+
* **[Day 3](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%203.md "Day 3 Status")**- ***Question 10-13***
31+
32+
33+
* **[Day 4](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%204.md "Day 4 Status")**- ***Question 14-15***
34+
35+
36+
* **[Day 5](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%205.md "Day 5 Status")**- ***Question 16-17***
37+
38+
39+
* **[Day 6](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%206.md "Day 6 Status")**- ***Question 18-19***
40+
41+
* **[Day 7](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%207.md "Day 7 Status")**- ***Question 20-21***
42+
43+
44+
* **[Day 8](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%208.md "Day 8 Status")**- ***Question 22-25***
45+
46+
47+
* **[Day 9](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day%209.md "Day 9 Status")**- ***Question 26-30***
48+
49+
50+
* **[Day 10](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_10.md "Day 10 Status")**- ***Question 31-37***
51+
52+
* **[Day 11](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_11.md "Day 11 Status")**- ***Question 38-43***
53+
54+
* **[Day 12](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_12.md "Day 12 Status")**- ***Question 44-46***
55+
56+
57+
* **[Day 13](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_13.md "Day 13 Status")**- ***Question 47-50***
58+
59+
60+
* **[Day 14](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_14.md "Day 14 Status")**- ***Question 51-53***
61+
62+
* **[Day 15](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_15.md "Day 15 Status")**- ***Question 54-59***
63+
64+
* **[Day 16](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_16.md "Day 16 Status")**- ***Question 60-64***
65+
66+
67+
* **[Day 17](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_17.md "Day 17 Status")**- ***Question 65-69***
68+
69+
70+
* **[Day 18](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_18.md "Day 18 Status")**- ***Question 70-74***
71+
72+
73+
* **[Day 19](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_19.md "Day 19 Status")**- ***Question 75-79***
74+
75+
76+
* **[Day 20](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_20.md "Day 20 Status")**- ***Question 80-84***
77+
78+
* **[Day 21](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_21.md "Day 21 Status")**- ***Question 85-89***
79+
80+
* **[Day 22](https://github.com/darkprinx/100-plus-Python-programming-exercises-extended/blob/master/Status/Day_22.md "Day 22 Status")**- ***Question 90-94***

Status/Day 1.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11

22
# Question 1
3-
### Level 1
4-
-----------------
53

6-
**Question:**
4+
### **Question:**
75

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

119
--------------------------------------
12-
### Hints: Consider use range(#begin, #end) method
10+
### Hints:
11+
> ***Consider use range(#begin, #end) method.***
12+
1313
---------------------------------------
1414

1515
**Main author's Solution: Python 2**
16-
```
16+
```python
1717
l=[]
1818
for i in range(2000, 3201):
1919
if (i%7==0) and (i%5!=0):
@@ -24,7 +24,7 @@ print ','.join(l)
2424
----------------------------------------
2525

2626
**My Solution: Python 3**
27-
```
27+
```python
2828
for i in range(2000,3201):
2929
if i%7 == 0 and i%5!=0:
3030
print(i,end=',')
@@ -33,19 +33,19 @@ print("\b")
3333
-------------------------------
3434

3535
# Question 2
36-
### Level 1
37-
---------------
3836

39-
**Question:**
37+
### **Question:**
4038

41-
***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
39+
> ***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
4240
Then, the output should be:40320***
4341

4442
--------------------
45-
### Hints:In case of input data being supplied to the question, it should be assumed to be a console input.
43+
### Hints:
44+
>***In case of input data being supplied to the question, it should be assumed to be a console input.***
45+
4646
---------------
4747
**Main author's Solution: Python 2**
48-
```
48+
```python
4949
def fact(x):
5050
if x == 0:
5151
return 1
@@ -58,7 +58,7 @@ print fact(x)
5858
**My Solution: Python 3**
5959

6060
* **Using While Loop**
61-
```
61+
```python
6262
n = int(raw_input()) #input() function takes input as string type
6363
#int() converts it to integer type
6464
fact = 1
@@ -69,7 +69,7 @@ print fact(x)
6969
print(fact)
7070
```
7171
* **Using For Loop**
72-
```
72+
```python
7373
n = int(input()) #input() function takes input as string type
7474
#int() converts it to integer type
7575
fact = 1
@@ -80,21 +80,24 @@ print fact(x)
8080
-------------------
8181

8282
# Question 3
83-
## Level 1
84-
--------------------
85-
**Question:**
8683

87-
***With a given integral number n, write a program to generate a dictionary that contains (i, i * 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***
84+
### **Question:**
8885

89-
***Then, the output should be:
90-
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}***
86+
>***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***
9187

88+
>***Then, the output should be:***
89+
```
90+
{1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64}
91+
```
9292
------------------
93-
### Hints: In case of input data being supplied to the question, it should be assumed to be a console input.Consider use dict()
93+
94+
### Hints:
95+
>***In case of input data being supplied to the question, it should be assumed to be a console input.Consider use dict()***
96+
9497
-----------------
9598
9699
**Main author's Solution: Python 2**
97-
```
100+
```python
98101
n = int(raw_input())
99102
d = dict()
100103
for i in range(1,n+1):
@@ -103,15 +106,15 @@ print d
103106
```
104107

105108
**My Solution: Python 3:**
106-
```
109+
```python
107110
n = int(input())
108111
ans = {}
109112
for i in range (1,n+1):
110113
ans[i] = i * i
111114
print(ans)
112115
```
113116
**OR**
114-
```
117+
```python
115118
# This is done with dictionary comprehension method
116119
n = int(input())
117120
ans={i : i*i for i in range(1,n+1)}

0 commit comments

Comments
 (0)