Skip to content

Commit b27bf4e

Browse files
committed
Update Loops.ipynb
1 parent d32c7d9 commit b27bf4e

File tree

1 file changed

+119
-36
lines changed

1 file changed

+119
-36
lines changed

Loops.ipynb

Lines changed: 119 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,42 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 2,
12+
"execution_count": 16,
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
16-
"seq = [1,2,3,4,5]"
16+
"seq = [1,2]"
1717
]
1818
},
1919
{
2020
"cell_type": "code",
21-
"execution_count": 3,
21+
"execution_count": 4,
2222
"metadata": {},
2323
"outputs": [
2424
{
2525
"name": "stdout",
2626
"output_type": "stream",
2727
"text": [
28-
"1\n",
29-
"2\n",
30-
"3\n",
31-
"4\n",
32-
"5\n"
28+
"1 Hello\n",
29+
"2 Hello\n",
30+
"3 Hello\n"
3331
]
3432
}
3533
],
3634
"source": [
37-
"for item in seq:\n",
38-
" print(item)"
35+
"for i in seq:\n",
36+
" print(str(i)+\" Hello\")"
3937
]
4038
},
4139
{
4240
"cell_type": "code",
43-
"execution_count": 4,
41+
"execution_count": 6,
4442
"metadata": {},
4543
"outputs": [
4644
{
4745
"name": "stdout",
4846
"output_type": "stream",
4947
"text": [
50-
"Yep\n",
51-
"Yep\n",
5248
"Yep\n",
5349
"Yep\n",
5450
"Yep\n"
@@ -62,52 +58,44 @@
6258
},
6359
{
6460
"cell_type": "code",
65-
"execution_count": 5,
61+
"execution_count": 17,
6662
"metadata": {},
6763
"outputs": [
6864
{
6965
"name": "stdout",
7066
"output_type": "stream",
7167
"text": [
72-
"2\n",
73-
"4\n",
74-
"6\n",
75-
"8\n",
76-
"10\n"
68+
"1 Hello\n",
69+
"2 Hello\n",
70+
"1 Hello\n",
71+
"2 Hello\n"
7772
]
7873
}
7974
],
8075
"source": [
8176
"for jelly in seq:\n",
82-
" print(jelly+jelly)"
77+
" for i in seq:\n",
78+
" print(str(i)+\" Hello\")"
8379
]
8480
},
8581
{
8682
"cell_type": "code",
87-
"execution_count": 6,
83+
"execution_count": 14,
8884
"metadata": {},
8985
"outputs": [
9086
{
9187
"name": "stdout",
9288
"output_type": "stream",
9389
"text": [
94-
"i is: 1\n",
95-
"i is: 1\n",
96-
"i is: 2\n",
97-
"i is: 2\n",
98-
"i is: 3\n",
99-
"i is: 3\n",
100-
"i is: 4\n",
101-
"i is: 4\n"
90+
"i is: --- 4 \n"
10291
]
10392
}
10493
],
10594
"source": [
106-
"i = 1\n",
95+
"i = 4\n",
10796
"while i < 5:\n",
108-
" print('i is: {}'.format(i))\n",
109-
" print(\"i is: \"+str(i))\n",
110-
" i = i+1"
97+
" print('i is: --- {} '.format(i))\n",
98+
" i=i+1"
11199
]
112100
},
113101
{
@@ -132,7 +120,7 @@
132120
},
133121
{
134122
"cell_type": "code",
135-
"execution_count": 8,
123+
"execution_count": 13,
136124
"metadata": {},
137125
"outputs": [
138126
{
@@ -143,12 +131,107 @@
143131
"1\n",
144132
"2\n",
145133
"3\n",
146-
"4\n"
134+
"4\n",
135+
"5\n",
136+
"6\n",
137+
"7\n",
138+
"8\n",
139+
"9\n",
140+
"10\n",
141+
"11\n",
142+
"12\n",
143+
"13\n",
144+
"14\n",
145+
"15\n",
146+
"16\n",
147+
"17\n",
148+
"18\n",
149+
"19\n",
150+
"20\n",
151+
"21\n",
152+
"22\n",
153+
"23\n",
154+
"24\n",
155+
"25\n",
156+
"26\n",
157+
"27\n",
158+
"28\n",
159+
"29\n",
160+
"30\n",
161+
"31\n",
162+
"32\n",
163+
"33\n",
164+
"34\n",
165+
"35\n",
166+
"36\n",
167+
"37\n",
168+
"38\n",
169+
"39\n",
170+
"40\n",
171+
"41\n",
172+
"42\n",
173+
"43\n",
174+
"44\n",
175+
"45\n",
176+
"46\n",
177+
"47\n",
178+
"48\n",
179+
"49\n",
180+
"50\n",
181+
"51\n",
182+
"52\n",
183+
"53\n",
184+
"54\n",
185+
"55\n",
186+
"56\n",
187+
"57\n",
188+
"58\n",
189+
"59\n",
190+
"60\n",
191+
"61\n",
192+
"62\n",
193+
"63\n",
194+
"64\n",
195+
"65\n",
196+
"66\n",
197+
"67\n",
198+
"68\n",
199+
"69\n",
200+
"70\n",
201+
"71\n",
202+
"72\n",
203+
"73\n",
204+
"74\n",
205+
"75\n",
206+
"76\n",
207+
"77\n",
208+
"78\n",
209+
"79\n",
210+
"80\n",
211+
"81\n",
212+
"82\n",
213+
"83\n",
214+
"84\n",
215+
"85\n",
216+
"86\n",
217+
"87\n",
218+
"88\n",
219+
"89\n",
220+
"90\n",
221+
"91\n",
222+
"92\n",
223+
"93\n",
224+
"94\n",
225+
"95\n",
226+
"96\n",
227+
"97\n",
228+
"98\n",
229+
"99\n"
147230
]
148231
}
149232
],
150233
"source": [
151-
"for i in range(5):\n",
234+
"for i in range(80):\n",
152235
" print(i)"
153236
]
154237
},

0 commit comments

Comments
 (0)