Skip to content

Commit 71bd068

Browse files
intial commit
intial commit
1 parent da72740 commit 71bd068

File tree

4 files changed

+105
-8
lines changed

4 files changed

+105
-8
lines changed

Control Flow/Enumerate_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
x = [5 ,7, 10, 12, 15, 20]
1515
y = [3 ,5, 4, 10, 10, 19]
1616
for x , y in zip(x,y):
17-
print('{} is greater than {}'.format(x,y))
17+
print('%s is greater than %s' %(x,y))
1818

MatplotLib/Matplotlib codes in Jupyter notebook.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
{
2626
"cell_type": "code",
27-
"execution_count": 7,
27+
"execution_count": 3,
2828
"metadata": {},
2929
"outputs": [
3030
{
@@ -53,7 +53,7 @@
5353
},
5454
{
5555
"cell_type": "code",
56-
"execution_count": 13,
56+
"execution_count": 4,
5757
"metadata": {
5858
"scrolled": true
5959
},
@@ -64,7 +64,7 @@
6464
"<BarContainer object of 5 artists>"
6565
]
6666
},
67-
"execution_count": 13,
67+
"execution_count": 4,
6868
"metadata": {},
6969
"output_type": "execute_result"
7070
},
@@ -89,7 +89,7 @@
8989
},
9090
{
9191
"cell_type": "code",
92-
"execution_count": 11,
92+
"execution_count": 5,
9393
"metadata": {},
9494
"outputs": [
9595
{
@@ -128,7 +128,7 @@
128128
},
129129
{
130130
"cell_type": "code",
131-
"execution_count": 20,
131+
"execution_count": 6,
132132
"metadata": {},
133133
"outputs": [
134134
{
@@ -159,7 +159,7 @@
159159
},
160160
{
161161
"cell_type": "code",
162-
"execution_count": 25,
162+
"execution_count": 7,
163163
"metadata": {},
164164
"outputs": [
165165
{
@@ -200,7 +200,7 @@
200200
},
201201
{
202202
"cell_type": "code",
203-
"execution_count": 40,
203+
"execution_count": 8,
204204
"metadata": {},
205205
"outputs": [
206206
{
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
'''
2+
A counter turns a sequence of values into a defaultdict(int)-like object mapping keys to counts. we will use
3+
it to create Histogram
4+
'''
5+
from collections import Counter
6+
document = (10,
7+
1,
8+
10,
9+
5,
10+
7,
11+
4,
12+
1,
13+
1,
14+
10,
15+
10,
16+
9,
17+
10,
18+
1,
19+
3,
20+
9,
21+
9,
22+
4,
23+
1,
24+
8,
25+
6,
26+
7,
27+
3,
28+
6,
29+
7,
30+
3,
31+
10,
32+
5,
33+
3,
34+
10,
35+
4,
36+
6,
37+
8,
38+
10,
39+
5,
40+
5,
41+
9,
42+
10,
43+
8,
44+
10,
45+
9,
46+
10,
47+
10,
48+
8,
49+
7,
50+
7,
51+
10,
52+
8,
53+
6,
54+
4,
55+
6,
56+
1,
57+
9,
58+
10,
59+
2,
60+
3,
61+
3,
62+
9,
63+
2,
64+
3,
65+
8,
66+
1,
67+
7,
68+
3,
69+
10,
70+
6,
71+
6,
72+
9,
73+
6,
74+
7,
75+
9)
76+
word_counts = Counter(document)
77+
for word, count in word_counts.most_common(10):
78+
print('The Number %d Comes %d times ' %(word,count))
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import random
2+
from collections import Counter
3+
4+
#Take User Input for lower and Upper Range For auto Genrare 100 Number
5+
lower_range = int(input('Enter Lower Rnge : ' ))
6+
upper_range = int(input('Enter Upper Range : ' ))
7+
8+
#Create a empty List to Append Random Number to List
9+
list0 = []
10+
11+
#create a random list to Lower range to Upper range
12+
for i in range(100):
13+
x = random.randint(lower_range, upper_range)
14+
list0.append(x)
15+
16+
#count the NUmber most common 5
17+
word_counts = Counter(list0)
18+
for word, count in word_counts.most_common(5):
19+
print('The Number %d Comes %d times ' %(word,count))

0 commit comments

Comments
 (0)