summaryrefslogtreecommitdiff
path: root/python/atms-310/notebooks/MT1 Review.ipynb
blob: 6b3f8c4d782eb90ede3afa40e43c924933b259cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1bf363de-ca7c-44a6-bd2f-4ca809666863",
   "metadata": {
    "tags": []
   },
   "source": [
    "<h1>MIDTERM 1 REVIEW</h1>\n",
    "\n",
    "<h2>10/16/2023</h2>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "51a1ad77-a7f8-4438-a7da-f082e340f798",
   "metadata": {},
   "source": [
    "<h3><b>Lecture Name:</b> Introduction to Python and Computer Architecture</h3>\n",
    "    \n",
    "<h3><b>File Name:</b> Week 01 W.pdf</h3>\n",
    "    \n",
    "<h3><b>Class Date:</b> 09/27/2023</h3>\n",
    "\n",
    "<b>Key Points:</b>\n",
    "\n",
    "<ul>\n",
    "    <li>Programming is the act of writing an <b>algorithm</b> using a specific syntax to solve a problem.\n",
    "    <ul>\n",
    "        <li>A big part of programming is taking a problem apart into smaller pieces that can be understood by a computer\n",
    "    </ul>\n",
    "    <li>A computer's structure consists of:\n",
    "    <ul>\n",
    "        <li>Input and output devices\n",
    "        <li>A central processing unit composed of a control unit and an arithmetic/logic unit\n",
    "        <li>A memory unit"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e30ff5c5-2236-400b-9157-73a77cae261c",
   "metadata": {},
   "source": [
    "<h3><b>Lecture Name:</b> Print, Calculator, Variable Types and Operators</h3>\n",
    "    \n",
    "<h3><b>File Name:</b> Week 01 F.ipynb</h3>\n",
    "    \n",
    "<h3><b>Class Date:</b> 09/29/2023</h3>\n",
    "\n",
    "<b>Key Points:</b>\n",
    "\n",
    "<ul>\n",
    "    <li>An <b>integer</b> variable is a number with no decimal point\n",
    "    <li>A <b>floating point</b> variable is a number with a decimal point\n",
    "    <li>A <b>string</b> variable is text\n",
    "    <li>A <b>Boolean</b> variable can take on the values <b>True</b> and <b>False</b>\n",
    "    <li>A <b>NoneType</b>variable can take on the value <b>None</b>\n",
    "    <li>Python uses dynamic typing, which means you don't need to define a variable's type when you first use that variable\n",
    "    <li>The type() command lets you see what type a given variable is. int(), float(), and str() can be used to convert to different variable types\n",
    "    <li>Combining a float and an integer results in a float\n",
    "    <li>Combining a string and an integer or float results in a TypeError\n",
    "    <li>Floats are often prone to rounding errors\n",
    "    <li><b>and</b> and <b>or</b> can be used to combine Boolean variables"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c8dcb344-0708-4ba9-9ccb-df22e34edea2",
   "metadata": {},
   "source": [
    "<h3><b>Lecture Name:</b> Lists and Dictionaries</h3>\n",
    "    \n",
    "<h3><b>File Name:</b> Week 02 M.ipynb</h3>\n",
    "    \n",
    "<h3><b>Class Date:</b> 10/02/2023</h3>\n",
    "\n",
    "<b>Key Points:</b>\n",
    "\n",
    "<ul>\n",
    "    <li> A list is a <b>mutable</b>, <b>ordered</b> sequence of elements\n",
    "    <li> Python counts starting with 0, not 1\n",
    "    <li> You can also count backwards from the end of a list using negative numbers\n",
    "    <li> A list can be sliced, where the slice is defined by a range that has an inclusive lower bound and an exclusive upper bound\n",
    "    <li> Values in a list can be changed by assignment or by particular methods\n",
    "    <li> A tuple is an <b>immutable</b>, <b>ordered</b> sequence of elements\n",
    "    <li> A dictionary is a <b>mutable</b>, <b>unordered</b> sequence of elements consisting of key:value pairs"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0af5f1b7-48e9-4131-a331-5e35826a677a",
   "metadata": {},
   "source": [
    "<h3><b>Lecture Name:</b> Functions and Logic</h3>\n",
    "    \n",
    "<h3><b>File Name:</b> Week 02 W.ipynb</h3>\n",
    "    \n",
    "<h3><b>Class Date:</b> 10/04/2023</h3>\n",
    "\n",
    "<b>Key Points:</b>\n",
    "\n",
    "<ul>\n",
    "    <li> A <b>function</b> is a block of code that can be called\n",
    "    <li> Functions can be called using either positional or keyword arguments\n",
    "    <li> Positional arguments can be described via lists and keyword arguments can be desribed via dictionaries\n",
    "    <li> Python uses if statements for logical constructs\n",
    "    <li> The code within an <b>if</b> statement is run if the current statement is true\n",
    "    <li> The code within an <b>elif</b> statement applies if prior statements are not true <b>and</b> the current statement is true\n",
    "    <li> The code within an <b>else</b> statement applies if all prior statements are not true"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "44c499c2-bab1-48be-8edc-c6c59a23659f",
   "metadata": {},
   "source": [
    "<h3><b>Lecture Name:</b> Loops</h3>\n",
    "    \n",
    "<h3><b>File Name:</b> Week 02 F.ipynb</h3>\n",
    "    \n",
    "<h3><b>Class Date:</b> 10/06/2023</h3>\n",
    "\n",
    "<b>Key Points:</b>\n",
    "\n",
    "<ul>\n",
    "    <li> A <b>for loop</b> lets you repeat an operation a specified number of times\n",
    "    <li> Indentation is critical for lists in Python\n",
    "    <li> The range() function will create a list of all values up to (but not including) the specified integer\n",
    "    <li> Hardcoding is the act of restricting a piece of code so it only works under specific circumstances (generally want to avoid this)\n",
    "    <li>A <b>while loop</b> lets you repeat an operation until a particular condition is met\n",
    "    <li>The index in a while loop must be initialized and care should be taken to avoid infinite loops"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7a2a73cf-6155-42d8-b792-7144f1821844",
   "metadata": {},
   "source": [
    "<h3><b>Lecture Name:</b> Modules and Exception Handling</h3>\n",
    "    \n",
    "<h3><b>File Name:</b> Week 03 M.ipynb</h3>\n",
    "    \n",
    "<h3><b>Class Date:</b> 10/09/2023</h3>\n",
    "\n",
    "<b>Key Points:</b>\n",
    "\n",
    "<ul>\n",
    "    <li>A <b>module</b> is a library of Python source code that gives access to new variables and functions\n",
    "    <li>Modules can be imported as whatever name you like\n",
    "    <li>A <b>raise</b> statement lets you define your own error conditions and stop code when they're met\n",
    "    <li>A <b>try/except</b> block will let you fix common issues that would otherwise result in exceptions"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1972b16e-0c87-482b-8e05-dd4c99b3c11c",
   "metadata": {},
   "source": [
    "<h3><b>Lecture Name:</b> Arrays</h3>\n",
    "    \n",
    "<h3><b>File Name:</b> Week 02 W.ipynb</h3>\n",
    "    \n",
    "<h3><b>Class Date:</b> 10/11/2023</h3>\n",
    "\n",
    "<b>Key Points:</b>\n",
    "\n",
    "<ul>\n",
    "    <li> An array is NumPy's version of a list, which allows you to work with matrices\n",
    "    <li> All elements of an array are of the same type\n",
    "    <li> You can either create a new array or convert an existing list into one\n",
    "    <li> The zeros() function is useful for initializing an array when you know the shape and size but not the contents\n",
    "    <li> The arange() function serves a similar purpose to the range() function with lists\n",
    "    <li> Similar to lists, arrays can be sliced, but arrays can also be sliced across each of their dimensions"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "31e2ef42-a0ec-468a-8c53-189b314186ee",
   "metadata": {},
   "source": [
    "<h3><b>Lecture Name:</b> Testing Inside Arrays</h3>\n",
    "    \n",
    "<h3><b>File Name:</b> Week 03 F.ipynb</h3>\n",
    "    \n",
    "<h3><b>Class Date:</b> 10/13/2023</h3>\n",
    "\n",
    "<b>Key Points:</b>\n",
    "\n",
    "<ul>\n",
    "    <li> You can use functions within NumPy to find the shape, number of dimensions, and number of elements in any array\n",
    "    <li> <b>numpy.where()</b> will let you find the locations of elements within an array that meet a specified criterion\n",
    "    <li> Some functions within NumPy allow you to manipulate arrays, such as reshaping, transpoing, unraveling, concatenation, and repeating individual array elements\n",
    "    <li> When you're in a situation with multiple nested loops, often you can instead perform all operations a lot more easily by using array syntax\n",
    "    <li> Mathematical operations act on arrays elementwise\n",
    "    <li> When testing within an array, <b>and</b> and <b>or</b> cannot be used; instead, use NumPy's built-in functions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4d9362ec-b4ad-421d-8e13-74527bc19ede",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}