Skip to content

Commit 6bad021

Browse files
authored
Merge pull request #10 from fhdsl/Season_5
s5 final
2 parents d98d52b + 2ce7c41 commit 6bad021

File tree

229 files changed

+19130
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+19130
-68
lines changed

01-Fundamentals.qmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In [Intro to Python](https://hutchdatascience.org/Intro_to_Python/), you learned
1515
We will be looking at a dataset from Twitter that looks like the following:
1616

1717
| Tweet_ID | Username | Text | Retweets | Likes | Timestamp |
18-
|------------|------------|------------|------------|------------|------------|
18+
|----------|----------------|-------------------------------------------|----------|-------|---------------------|
1919
| 1 | julie81 | Party least receive say or single.... | 2 | 25 | 2023-01-30 11:00:51 |
2020
| 2 | richardhester | Hotel still Congress may member staff.... | 35 | 29 | 2023-01-02 22:45:58 |
2121
| 3 | williamsjoseph | Nice be her debate industry that year.... | 51 | 25 | 2023-01-18 11:25:19 |

02-Iteration.qmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ for key, value in sentiment.items():
185185

186186
**Ranges** are a collection of sequential numbers, such as:
187187

188-
- 1, 2, 3, 4, 5
188+
- 1, 2, 3, 4, 5
189189

190190
- 1, 3, 5
191191

03-Conditionals.qmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Let's see this in action step by step:
103103
104104
</iframe>
105105

106-
If it doesn't load properly, you can find it [here](https://pythontutor.com/render.html#code=heartrates%20%3D%20%5B68,%2054,%2072,%2066,%2090,%20102%5D%0A%0Afor%20index,%20rate%20in%20enumerate%28heartrates%29%3A%0A%20%20if%20rate%20%3E%200%20and%20rate%20%3C%3D%2060%3A%0A%20%20%20%20heartrates%5Bindex%5D%20%3D%20%22low%22%0A%20%20elif%20rate%20%3E%2060%20and%20rate%20%3C%3D%20100%3A%0A%20%20%20%20heartrates%5Bindex%5D%20%3D%20%22medium%22%0A%20%20elif%20rate%20%3E%20100%3A%0A%20%20%20%20heartrates%5Bindex%5D%20%3D%20%22high%22%0A%20%20else%3A%0A%20%20%20%20heartrates%5Bindex%5D%20%3D%20%22unknown%22%0A%20%20%20%20%0Aprint%28heartrates%29&cumulative=false&curInstr=0&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false)
106+
If it doesn't load properly, you can find it [here](https://pythontutor.com/render.html#code=heartrates%20%3D%20%5B68,%2054,%2072,%2066,%2090,%20102%5D%0A%0Afor%20index,%20rate%20in%20enumerate%28heartrates%29%3A%0A%20%20if%20rate%20%3E%200%20and%20rate%20%3C%3D%2060%3A%0A%20%20%20%20heartrates%5Bindex%5D%20%3D%20%22low%22%0A%20%20elif%20rate%20%3E%2060%20and%20rate%20%3C%3D%20100%3A%0A%20%20%20%20heartrates%5Bindex%5D%20%3D%20%22medium%22%0A%20%20elif%20rate%20%3E%20100%3A%0A%20%20%20%20heartrates%5Bindex%5D%20%3D%20%22high%22%0A%20%20else%3A%0A%20%20%20%20heartrates%5Bindex%5D%20%3D%20%22unknown%22%0A%20%20%20%20%0Aprint%28heartrates%29&cumulative=false&curInstr=0&heapPrimitives=nevernest&mode=display&origin=opt-frontend.js&py=311&rawInputLstJSON=%5B%5D&textReferences=false).
107107

108108
## Exercises
109109

04-Functions.qmd

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
After learning how to use other people's functions, it's time to write our own! We will look at the anatomy of how a function is constructed, and see bunch of examples in action.
44

5-
![Source: <https://moffett4understandingmath.com/wp-content/uploads/2017/06/function-machine.png>](https://moffett4understandingmath.com/wp-content/uploads/2017/06/function-machine.png){width="300"}
6-
75
First, we remind ourselves why we write functions in the first place. We write functions for two main, often overlapping, reasons:
86

97
1. Following DRY (Don't Repeat Yourself) principle: If you find yourself repeating similar patterns of code, you should write a function that executes that pattern. This saves time and the risk of mistakes.
@@ -60,9 +58,9 @@ We need to introduce the concept of local and global environments to distinguish
6058

6159
Within a function, all input arguments and any new variables defined are stored in a "**local environment**", and is only accessible within the function's body. The overall environment of the program is called the "**global environment**" and can be also accessed within the function.
6260

63-
The reason of having some of this "privacy" in the local environment is to make functions modular - they are independent little tools that should not interact with the rest of the global environment. Imagine someone writing a tool that they want to give someone else to use, but the tool depends on your environment, vice versa.
61+
The reason of having some of this "privacy" in the local environment is to make functions modular - they are independent little tools that should not interact with the rest of the global environment. Imagine you writing a function that you want to give someone else to use, but your function depends on your global environment - it would not be portable!
6462

65-
To illustrate the distinguish between a the local and global environment, the following tool allows you to step through Python code execution line-by-line and see the relationship between order of execution, variables, and environments. The "Global frame" refers to the global environment, and "add_numbers" refer to the local environment for the function `add_numbers()`.
63+
To illustrate the distinction between a the local and global environment, the following tool allows you to step through Python code execution line-by-line and see the relationship between order of execution, variables, and environments. The "Global frame" refers to the global environment, and "add_numbers" refer to the local environment for the function `add_numbers()`.
6664

6765
<iframe width="800" height="500" frameborder="0" src="https://pythontutor.com/iframe-embed.html#code=def%20add_numbers%28num1,%20num2%29%3A%0A%20%20%22%22%22%20Adds%20two%20input%20numbers%20together.%20%22%22%22%0A%20%20result%20%3D%20num1%20%2B%20num2%0A%20%20return%20result%0A%20%20%0Aadd_numbers%283,%204%29&amp;codeDivHeight=400&amp;codeDivWidth=350&amp;cumulative=false&amp;curInstr=0&amp;heapPrimitives=nevernest&amp;origin=opt-frontend.js&amp;py=311&amp;rawInputLstJSON=%5B%5D&amp;textReferences=false">
6866
@@ -111,4 +109,4 @@ The function did not work as expected because we used hard-coded variables (`x`,
111109

112110
## Exercises
113111

114-
Exercise for week 3 can be found [here](https://colab.research.google.com/drive/1d07xM-0vCFNVFoJF32yBMvNtUsGjC_n3?usp=sharing).
112+
Exercise for week 4 can be found [here](https://colab.research.google.com/drive/1d07xM-0vCFNVFoJF32yBMvNtUsGjC_n3?usp=sharing).

05-Iteration_Styles.qmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,4 @@ for i, value in simple_df.measurement1.items():
202202

203203
## Exercises
204204

205-
Exercise for week 4 can be found [here](https://colab.research.google.com/drive/1qrfGCF2Bh_7hjqvDg2ASXWllzw0kPw1Q?usp=sharing).
205+
Exercise for week 5 can be found [here](https://colab.research.google.com/drive/1qrfGCF2Bh_7hjqvDg2ASXWllzw0kPw1Q?usp=sharing).

06-Reference_vs_Copy.qmd

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ They are the same.
7373

7474
Here is another visual way to think about this:
7575

76-
![If you imagine variables are like boxes, you can\'t make sense of assignment in Python; instead, think of variables as sticky notes. Image source: Fluent Python, Chapter 8.](images/references.png)If you imagine variables are like boxes, you can't make sense of assignment in Python; instead, think of variables as sticky notes. Image source: Fluent Python, Chapter 8.
76+
![If you imagine variables are like boxes, you can't make sense of assignment in Python; instead, think of variables as sticky notes. Image source: Fluent Python, Chapter 8.](images/references.png)If you imagine variables are like boxes, you can't make sense of assignment in Python; instead, think of variables as sticky notes. Image source: Fluent Python, Chapter 8.
7777

7878
### An object isn't unique
7979

@@ -281,4 +281,4 @@ This behavior is super inconsistent and confusing, as it's hard to predict when
281281

282282
## Exercises
283283

284-
Exercise for week 5 can be found [here](https://colab.research.google.com/drive/1re65RfslckVFiQB_utWNyppd3kx0PLPH?usp=sharing).
284+
Exercise for week 6 can be found [here](https://colab.research.google.com/drive/1re65RfslckVFiQB_utWNyppd3kx0PLPH?usp=sharing).

images/Intermediate_Python_R2.png

636 KB
Loading

slides/images/stickers mosaic.png

277 KB
Loading

0 commit comments

Comments
 (0)