Skip to content

Commit 0fa8b14

Browse files
committed
Final commit before Python Basics List Video
1 parent 68863d2 commit 0fa8b14

1 file changed

Lines changed: 60 additions & 36 deletions

File tree

Python_Basics/Intro/Python3Basics_Part1.ipynb

Lines changed: 60 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@
11501150
"cell_type": "markdown",
11511151
"metadata": {},
11521152
"source": [
1153-
"Python has a great built-in list type named \"list\". List literals are written within square brackets [ ]. After defining a list, square brackets [ ] are used to access data, with the first element at index 0. Lists are mutable (you are modify a list)"
1153+
"Lists are written within square brackets [ ]"
11541154
]
11551155
},
11561156
{
@@ -1165,7 +1165,7 @@
11651165
},
11661166
{
11671167
"cell_type": "code",
1168-
"execution_count": 12,
1168+
"execution_count": 134,
11691169
"metadata": {
11701170
"collapsed": true
11711171
},
@@ -1183,7 +1183,7 @@
11831183
},
11841184
{
11851185
"cell_type": "code",
1186-
"execution_count": 13,
1186+
"execution_count": 133,
11871187
"metadata": {},
11881188
"outputs": [
11891189
{
@@ -1192,18 +1192,19 @@
11921192
"3"
11931193
]
11941194
},
1195-
"execution_count": 13,
1195+
"execution_count": 133,
11961196
"metadata": {},
11971197
"output_type": "execute_result"
11981198
}
11991199
],
12001200
"source": [
1201+
"# The first element of a list is at index 0\n",
12011202
"z[0]"
12021203
]
12031204
},
12041205
{
12051206
"cell_type": "code",
1206-
"execution_count": 14,
1207+
"execution_count": 124,
12071208
"metadata": {},
12081209
"outputs": [
12091210
{
@@ -1212,7 +1213,7 @@
12121213
"4"
12131214
]
12141215
},
1215-
"execution_count": 14,
1216+
"execution_count": 124,
12161217
"metadata": {},
12171218
"output_type": "execute_result"
12181219
}
@@ -1223,23 +1224,23 @@
12231224
},
12241225
{
12251226
"cell_type": "code",
1226-
"execution_count": 15,
1227+
"execution_count": 127,
12271228
"metadata": {},
12281229
"outputs": [
12291230
{
12301231
"data": {
12311232
"text/plain": [
1232-
"2"
1233+
"7"
12331234
]
12341235
},
1235-
"execution_count": 15,
1236+
"execution_count": 127,
12361237
"metadata": {},
12371238
"output_type": "execute_result"
12381239
}
12391240
],
12401241
"source": [
12411242
"# Access Last Element of List \n",
1242-
"z[-1]"
1243+
"z[-3]"
12431244
]
12441245
},
12451246
{
@@ -1253,7 +1254,7 @@
12531254
},
12541255
{
12551256
"cell_type": "code",
1256-
"execution_count": 16,
1257+
"execution_count": 120,
12571258
"metadata": {},
12581259
"outputs": [
12591260
{
@@ -1262,21 +1263,20 @@
12621263
"[3, 7]"
12631264
]
12641265
},
1265-
"execution_count": 16,
1266+
"execution_count": 120,
12661267
"metadata": {},
12671268
"output_type": "execute_result"
12681269
}
12691270
],
12701271
"source": [
1271-
"# get range of values from list\n",
12721272
"# first index is inclusive (before the :) and last (after the :) is not. \n",
12731273
"# not including index 2\n",
12741274
"z[0:2]"
12751275
]
12761276
},
12771277
{
12781278
"cell_type": "code",
1279-
"execution_count": 174,
1279+
"execution_count": 22,
12801280
"metadata": {},
12811281
"outputs": [
12821282
{
@@ -1285,19 +1285,19 @@
12851285
"[3, 7, 4]"
12861286
]
12871287
},
1288-
"execution_count": 174,
1288+
"execution_count": 22,
12891289
"metadata": {},
12901290
"output_type": "execute_result"
12911291
}
12921292
],
12931293
"source": [
1294-
"# start to before index 3\n",
1294+
"# everything up to index 3\n",
12951295
"z[:3]"
12961296
]
12971297
},
12981298
{
12991299
"cell_type": "code",
1300-
"execution_count": 175,
1300+
"execution_count": 47,
13011301
"metadata": {},
13021302
"outputs": [
13031303
{
@@ -1306,7 +1306,7 @@
13061306
"[7, 4, 2]"
13071307
]
13081308
},
1309-
"execution_count": 175,
1309+
"execution_count": 47,
13101310
"metadata": {},
13111311
"output_type": "execute_result"
13121312
}
@@ -1349,7 +1349,7 @@
13491349
},
13501350
{
13511351
"cell_type": "code",
1352-
"execution_count": 177,
1352+
"execution_count": 128,
13531353
"metadata": {},
13541354
"outputs": [
13551355
{
@@ -1358,7 +1358,7 @@
13581358
"3"
13591359
]
13601360
},
1361-
"execution_count": 177,
1361+
"execution_count": 128,
13621362
"metadata": {},
13631363
"output_type": "execute_result"
13641364
}
@@ -1387,7 +1387,7 @@
13871387
},
13881388
{
13891389
"cell_type": "code",
1390-
"execution_count": 178,
1390+
"execution_count": 129,
13911391
"metadata": {},
13921392
"outputs": [
13931393
{
@@ -1396,7 +1396,7 @@
13961396
"0"
13971397
]
13981398
},
1399-
"execution_count": 178,
1399+
"execution_count": 129,
14001400
"metadata": {},
14011401
"output_type": "execute_result"
14021402
}
@@ -1407,7 +1407,7 @@
14071407
},
14081408
{
14091409
"cell_type": "code",
1410-
"execution_count": 179,
1410+
"execution_count": 75,
14111411
"metadata": {},
14121412
"outputs": [
14131413
{
@@ -1416,7 +1416,7 @@
14161416
"3"
14171417
]
14181418
},
1419-
"execution_count": 179,
1419+
"execution_count": 75,
14201420
"metadata": {},
14211421
"output_type": "execute_result"
14221422
}
@@ -1456,7 +1456,7 @@
14561456
},
14571457
{
14581458
"cell_type": "code",
1459-
"execution_count": 181,
1459+
"execution_count": 50,
14601460
"metadata": {
14611461
"collapsed": true
14621462
},
@@ -1468,7 +1468,7 @@
14681468
},
14691469
{
14701470
"cell_type": "code",
1471-
"execution_count": 182,
1471+
"execution_count": 51,
14721472
"metadata": {},
14731473
"outputs": [
14741474
{
@@ -1481,13 +1481,14 @@
14811481
],
14821482
"source": [
14831483
"# Sorting and Altering original list\n",
1484+
"# low to high\n",
14841485
"x.sort()\n",
14851486
"print(x)"
14861487
]
14871488
},
14881489
{
14891490
"cell_type": "code",
1490-
"execution_count": 183,
1491+
"execution_count": 52,
14911492
"metadata": {},
14921493
"outputs": [
14931494
{
@@ -1500,13 +1501,14 @@
15001501
],
15011502
"source": [
15021503
"# Sorting and Altering original list\n",
1504+
"# high to low\n",
15031505
"x.sort(reverse = True)\n",
15041506
"print(x)"
15051507
]
15061508
},
15071509
{
15081510
"cell_type": "code",
1509-
"execution_count": 184,
1511+
"execution_count": 53,
15101512
"metadata": {},
15111513
"outputs": [
15121514
{
@@ -1519,13 +1521,14 @@
15191521
],
15201522
"source": [
15211523
"# Sorting and Altering original list\n",
1524+
"# A-Z\n",
15221525
"y.sort()\n",
15231526
"print(y)"
15241527
]
15251528
},
15261529
{
15271530
"cell_type": "code",
1528-
"execution_count": 185,
1531+
"execution_count": 54,
15291532
"metadata": {},
15301533
"outputs": [
15311534
{
@@ -1538,13 +1541,14 @@
15381541
],
15391542
"source": [
15401543
"# Sorting and Altering original list\n",
1544+
"# Z-A\n",
15411545
"y.sort(reverse = True)\n",
15421546
"print(y)"
15431547
]
15441548
},
15451549
{
15461550
"cell_type": "code",
1547-
"execution_count": 186,
1551+
"execution_count": 55,
15481552
"metadata": {},
15491553
"outputs": [
15501554
{
@@ -1553,7 +1557,7 @@
15531557
"['Adam', 'Jessica', 'Lester', 'Michael', 'Monica', 'Rachel', 'Steve']"
15541558
]
15551559
},
1556-
"execution_count": 186,
1560+
"execution_count": 55,
15571561
"metadata": {},
15581562
"output_type": "execute_result"
15591563
}
@@ -1566,7 +1570,7 @@
15661570
},
15671571
{
15681572
"cell_type": "code",
1569-
"execution_count": 187,
1573+
"execution_count": 56,
15701574
"metadata": {},
15711575
"outputs": [
15721576
{
@@ -1575,7 +1579,7 @@
15751579
"['Steve', 'Rachel', 'Monica', 'Michael', 'Lester', 'Jessica', 'Adam']"
15761580
]
15771581
},
1578-
"execution_count": 187,
1582+
"execution_count": 56,
15791583
"metadata": {},
15801584
"output_type": "execute_result"
15811585
}
@@ -1594,7 +1598,27 @@
15941598
},
15951599
{
15961600
"cell_type": "code",
1597-
"execution_count": 188,
1601+
"execution_count": 57,
1602+
"metadata": {},
1603+
"outputs": [
1604+
{
1605+
"data": {
1606+
"text/plain": [
1607+
"[11, 10, 8, 7, 4, 3, 2]"
1608+
]
1609+
},
1610+
"execution_count": 57,
1611+
"metadata": {},
1612+
"output_type": "execute_result"
1613+
}
1614+
],
1615+
"source": [
1616+
"x"
1617+
]
1618+
},
1619+
{
1620+
"cell_type": "code",
1621+
"execution_count": 58,
15981622
"metadata": {},
15991623
"outputs": [
16001624
{
@@ -1644,14 +1668,14 @@
16441668
},
16451669
{
16461670
"cell_type": "code",
1647-
"execution_count": 190,
1671+
"execution_count": 59,
16481672
"metadata": {},
16491673
"outputs": [
16501674
{
16511675
"name": "stdout",
16521676
"output_type": "stream",
16531677
"text": [
1654-
"[11, 8, 7, 4, 3, 2, 3]\n"
1678+
"[11, 10, 8, 7, 4, 3, 2, 3]\n"
16551679
]
16561680
}
16571681
],

0 commit comments

Comments
 (0)