Skip to content

Commit 23754ab

Browse files
chennesyjt14den
authored andcommitted
update to fstrings in 2 episodes
1 parent 11f8098 commit 23754ab

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

episodes/functions.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,15 @@ A
7777
`max()` and `min()` must be given at least one argument and they must be given things that can meaningfully be compared.
7878

7979
```python
80-
print(max(1, 'a'))
80+
max(1, 'a')
8181
```
8282

8383
```error
84-
TypeError: unorderable types: str() > int()
84+
TypeError Traceback (most recent call last)
85+
Cell In[6], line 1
86+
----> 1 max(1, 'a')
87+
88+
TypeError: '>' not supported between instances of 'str' and 'int'
8589
```
8690

8791
## Function argument default values, and `round()`.
@@ -131,11 +135,11 @@ round(...)
131135

132136
## Every function returns something.
133137

134-
Every function call produces some result and if the function doesn't have a useful result to return, it usually returns the special value `None`.
138+
Every function call produces some result and if the function doesn't have a useful result to return, it usually returns the special value `None`. Each line of Python code is executed in order. In this case, the second line call to `{result}` returns 'None' since the `print` statement in the previous line didn't return a value to the `result` variable.
135139

136140
```python
137141
result = print('example')
138-
print('result of print is', result)
142+
print(f'result of print is {result}')
139143
```
140144

141145
```output

episodes/libraries.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Use `import` to load a library into a program's memory. Then you can refer to th
4343
```python
4444
import string
4545

46-
print('The lower ascii letters are', string.ascii_lowercase)
46+
print(f'The lower ascii letters are {string.ascii_lowercase}')
4747
print(string.capwords('capitalise this sentence please.'))
4848
```
4949

@@ -109,7 +109,7 @@ You can use `from ... import ...` to load specific items from a library module t
109109
```python
110110
from string import ascii_letters
111111

112-
print('The ASCII letters are', ascii_letters)
112+
print(f'The ASCII letters are {ascii_letters}')
113113
```
114114

115115
```output

learners/setup.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Setup
55
## Installing Python Using Anaconda
66
Python is a popular language for research computing, and great for general-purpose programming as well. Installing all of its research packages individually can be a bit difficult, so we recommend Anaconda, an all-in-one installer.
77

8-
Regardless of how you choose to install it, please make sure you install Python 3.x. The latest 3.x version recommended on [Python.org][python] is fine.
8+
Regardless of how you choose to install it, please make sure you install Python 3.6 or above. The latest 3.x version recommended on [Python.org][python] is fine.
99

1010
We will teach Python using JupyterLab, a programming environment that runs in a web browser (JupyterLab will be installed by Anaconda). For this to work you will need a reasonably up-to-date browser. The current versions of the Chrome, Safari and Firefox browsers are all supported (some older browsers, including Internet Explorer version 9 and below, are not).
1111

0 commit comments

Comments
 (0)