1
+ {
2
+ "cells" : [
3
+ {
4
+ "cell_type" : " markdown" ,
5
+ "metadata" : {
6
+ "id" : " dHFgBhPpsNGI"
7
+ },
8
+ "source" : [
9
+ " # COURSE: Master math by coding in Python\n " ,
10
+ " # SECTION: Arithmetic\n " ,
11
+ " # VIDEO: Addition, subtraction, multiplication, division\n " ,
12
+ " \n " ,
13
+ " \n " ,
14
+ " ### https://www.udemy.com/course/math-with-python/?couponCode=202312\n " ,
15
+ " #### INSTRUCTOR: Mike X Cohen (http://sincxpress.com)\n " ,
16
+ " \n " ,
17
+ " This code roughly matches the code shown in the live recording: variable names, order of lines, and parameter settings may be slightly different."
18
+ ]
19
+ },
20
+ {
21
+ "cell_type" : " markdown" ,
22
+ "source" : [
23
+ " <a target=\" _blank\" href=\" https://colab.research.google.com/github/mikexcohen/MathWithPython/blob/main/python/mathWithPython_arithmetic_basicArith.ipynb\" >\n " ,
24
+ " <img src=\" https://colab.research.google.com/assets/colab-badge.svg\" alt=\" Open In Colab\" />\n " ,
25
+ " </a>"
26
+ ],
27
+ "metadata" : {
28
+ "id" : " knNYsQTDx0V0"
29
+ }
30
+ },
31
+ {
32
+ "cell_type" : " code" ,
33
+ "execution_count" : null ,
34
+ "metadata" : {
35
+ "id" : " nsZlbO8FsNGK"
36
+ },
37
+ "outputs" : [],
38
+ "source" : []
39
+ },
40
+ {
41
+ "cell_type" : " markdown" ,
42
+ "metadata" : {
43
+ "id" : " oAbH3hrnsNGL"
44
+ },
45
+ "source" : [
46
+ " # Addition"
47
+ ]
48
+ },
49
+ {
50
+ "cell_type" : " code" ,
51
+ "execution_count" : null ,
52
+ "metadata" : {
53
+ "id" : " DbKEYj95sNGL"
54
+ },
55
+ "outputs" : [],
56
+ "source" : [
57
+ " # use Python like a calculator\n " ,
58
+ " 4+5 # press Ctrl-Enter (cmd-Enter on mac) to find the answer!"
59
+ ]
60
+ },
61
+ {
62
+ "cell_type" : " code" ,
63
+ "execution_count" : null ,
64
+ "metadata" : {
65
+ "id" : " KSgO8N5vsNGL"
66
+ },
67
+ "outputs" : [],
68
+ "source" : [
69
+ " # can use multiple numbers at the same time:\n " ,
70
+ " 4 + 3/4 + 9.4"
71
+ ]
72
+ },
73
+ {
74
+ "cell_type" : " code" ,
75
+ "source" : [],
76
+ "metadata" : {
77
+ "id" : " peDrlMkCsfTD"
78
+ },
79
+ "execution_count" : null ,
80
+ "outputs" : []
81
+ },
82
+ {
83
+ "cell_type" : " markdown" ,
84
+ "metadata" : {
85
+ "id" : " tEeo7tFGsNGL"
86
+ },
87
+ "source" : [
88
+ " # Subtraction"
89
+ ]
90
+ },
91
+ {
92
+ "cell_type" : " code" ,
93
+ "execution_count" : null ,
94
+ "metadata" : {
95
+ "id" : " DEsf5_avsNGL"
96
+ },
97
+ "outputs" : [],
98
+ "source" : [
99
+ " # exactly how you'd think it should work!\n " ,
100
+ " 4 - 3 - 1"
101
+ ]
102
+ },
103
+ {
104
+ "cell_type" : " code" ,
105
+ "source" : [],
106
+ "metadata" : {
107
+ "id" : " jJ5OWJ_asf0A"
108
+ },
109
+ "execution_count" : null ,
110
+ "outputs" : []
111
+ },
112
+ {
113
+ "cell_type" : " markdown" ,
114
+ "metadata" : {
115
+ "id" : " c1zVShKXsNGL"
116
+ },
117
+ "source" : [
118
+ " # Multiplication"
119
+ ]
120
+ },
121
+ {
122
+ "cell_type" : " code" ,
123
+ "execution_count" : null ,
124
+ "metadata" : {
125
+ "id" : " Cgn343jFsNGM"
126
+ },
127
+ "outputs" : [],
128
+ "source" : [
129
+ " # Use * to indicate multiplication (not x!)\n " ,
130
+ " 3*4"
131
+ ]
132
+ },
133
+ {
134
+ "cell_type" : " code" ,
135
+ "execution_count" : null ,
136
+ "metadata" : {
137
+ "scrolled" : true ,
138
+ "id" : " YMG1v5rwsNGM"
139
+ },
140
+ "outputs" : [],
141
+ "source" : [
142
+ " # can mix operations\n " ,
143
+ " 3*4 - 3*2"
144
+ ]
145
+ },
146
+ {
147
+ "cell_type" : " code" ,
148
+ "source" : [],
149
+ "metadata" : {
150
+ "id" : " hSJoFYMNsgS4"
151
+ },
152
+ "execution_count" : null ,
153
+ "outputs" : []
154
+ },
155
+ {
156
+ "cell_type" : " markdown" ,
157
+ "metadata" : {
158
+ "id" : " htfgHhO5sNGM"
159
+ },
160
+ "source" : [
161
+ " # Division"
162
+ ]
163
+ },
164
+ {
165
+ "cell_type" : " code" ,
166
+ "execution_count" : null ,
167
+ "metadata" : {
168
+ "id" : " C-TIRyUgsNGM"
169
+ },
170
+ "outputs" : [],
171
+ "source" : [
172
+ " # use /\n " ,
173
+ " 3/4"
174
+ ]
175
+ },
176
+ {
177
+ "cell_type" : " code" ,
178
+ "execution_count" : null ,
179
+ "metadata" : {
180
+ "id" : " XGjLMKVDsNGM"
181
+ },
182
+ "outputs" : [],
183
+ "source" : [
184
+ " # error! Always use the forward slash\n " ,
185
+ " 3\\ 4"
186
+ ]
187
+ },
188
+ {
189
+ "cell_type" : " code" ,
190
+ "source" : [],
191
+ "metadata" : {
192
+ "id" : " BUhCF8Nssg51"
193
+ },
194
+ "execution_count" : null ,
195
+ "outputs" : []
196
+ },
197
+ {
198
+ "cell_type" : " markdown" ,
199
+ "metadata" : {
200
+ "id" : " 9zptOkk3sNGM"
201
+ },
202
+ "source" : [
203
+ " # Exercises!"
204
+ ]
205
+ },
206
+ {
207
+ "cell_type" : " code" ,
208
+ "execution_count" : null ,
209
+ "metadata" : {
210
+ "id" : " dg8xjp8IsNGM"
211
+ },
212
+ "outputs" : [],
213
+ "source" : [
214
+ " #1)\n " ,
215
+ " 5 - (2/4) * (3/5)"
216
+ ]
217
+ },
218
+ {
219
+ "cell_type" : " code" ,
220
+ "execution_count" : null ,
221
+ "metadata" : {
222
+ "id" : " Xak9fVzhsNGM"
223
+ },
224
+ "outputs" : [],
225
+ "source" : [
226
+ " #2)\n " ,
227
+ " (4-5) / 3+5*6"
228
+ ]
229
+ },
230
+ {
231
+ "cell_type" : " code" ,
232
+ "execution_count" : null ,
233
+ "metadata" : {
234
+ "id" : " 5J-0Rcp5sNGZ"
235
+ },
236
+ "outputs" : [],
237
+ "source" : []
238
+ }
239
+ ],
240
+ "metadata" : {
241
+ "kernelspec" : {
242
+ "display_name" : " Python 3" ,
243
+ "language" : " python" ,
244
+ "name" : " python3"
245
+ },
246
+ "language_info" : {
247
+ "codemirror_mode" : {
248
+ "name" : " ipython" ,
249
+ "version" : 3
250
+ },
251
+ "file_extension" : " .py" ,
252
+ "mimetype" : " text/x-python" ,
253
+ "name" : " python" ,
254
+ "nbconvert_exporter" : " python" ,
255
+ "pygments_lexer" : " ipython3" ,
256
+ "version" : " 3.7.0"
257
+ },
258
+ "colab" : {
259
+ "provenance" : []
260
+ }
261
+ },
262
+ "nbformat" : 4 ,
263
+ "nbformat_minor" : 0
264
+ }
0 commit comments