Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10bd222

Browse files
authored
Merge pull request dabeaz-course#3 from advishnuprasad/fix-broken-links
Fix broken links
2 parents dd96217 + 7a288a0 commit 10bd222

Some content is hidden

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

54 files changed

+300
-304
lines changed

Notes/00_Setup.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ exercises. Feel free to look at this if you need a hint. To get the
8686
most out of the course however, you should try to create your own
8787
solutions first.
8888

89-
[Contents](Contents)
89+
[Contents](Contents.md)
9090

9191

9292

Notes/01_Introduction/00_Overview.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
The goal of this first section is to introduce some Python basics from
44
the ground up. Starting with nothing, you'll learn how to edit, run,
55
and debug small programs. Ultimately, you'll write a short script that
6-
reads a CSV data file and performs a simple calculation.
6+
reads a CSV data file and performs a simple calculation.
77

8-
* [1.1 Introducing Python](01_Python)
9-
* [1.2 A First Program](02_Hello_world)
10-
* [1.3 Numbers](03_Numbers)
11-
* [1.4 Strings](04_Strings)
12-
* [1.5 Lists](05_Lists)
13-
* [1.6 Files](06_Files)
14-
* [1.7 Functions](07_Functions)
8+
* [1.1 Introducing Python](01_Python.md)
9+
* [1.2 A First Program](02_Hello_world.md)
10+
* [1.3 Numbers](03_Numbers.md)
11+
* [1.4 Strings](04_Strings.md)
12+
* [1.5 Lists](05_Lists.md)
13+
* [1.6 Files](06_Files.md)
14+
* [1.7 Functions](07_Functions.md)
1515

16-
[Contents](../Contents)
16+
[Contents](../Contents.md)
1717

Notes/01_Introduction/01_Python.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
[Contents](../Contents) \| [Next (1.2 A First Program)](02_Hello_world)
1+
[Contents](../Contents.md) \| [Next (1.2 A First Program)](02_Hello_world.md)
22

33
# 1.1 Python
44

55
### What is Python?
66

77
Python is an interpreted high level programming language. It is often classified as a
8-
["scripting language"](https://en.wikipedia.org/wiki/Scripting_language) and
8+
["scripting language"](https://en.wikipedia.org/wiki/Scripting_language) and
99
is considered similar to languages such as Perl, Tcl, or Ruby. The syntax
1010
of Python is loosely inspired by elements of C programming.
1111

@@ -40,12 +40,12 @@ able to type `python` like this:
4040

4141
```
4242
bash $ python
43-
Python 3.8.1 (default, Feb 20 2020, 09:29:22)
43+
Python 3.8.1 (default, Feb 20 2020, 09:29:22)
4444
[Clang 10.0.0 (clang-1000.10.44.4)] on darwin
4545
Type "help", "copyright", "credits" or "license" for more information.
4646
>>> print("hello world")
4747
hello world
48-
>>>
48+
>>>
4949
```
5050

5151
If you are new to using the shell or a terminal, you should probably
@@ -187,5 +187,5 @@ exercise work. For example:
187187
If you can't make this work, don't worry about it. The rest of this course
188188
has nothing to do with parsing XML.
189189

190-
[Contents](../Contents) \| [Next (1.2 A First Program)](02_Hello_world)
190+
[Contents](../Contents.md) \| [Next (1.2 A First Program)](02_Hello_world.md)
191191

Notes/01_Introduction/02_Hello_world.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[Contents](../Contents) \| [Previous (1.1 Python)](01_Python) \| [Next (1.3 Numbers)](03_Numbers)
1+
[Contents](../Contents.md) \| [Previous (1.1 Python)](01_Python.md) \| [Next (1.3 Numbers)](03_Numbers.md)
22

33
# 1.2 A First Program
44

@@ -51,7 +51,7 @@ hello world
5151
This so-called *read-eval-print-loop* (or REPL) is very useful for debugging and exploration.
5252

5353
**STOP**: If you can't figure out how to interact with Python, stop what you're doing
54-
and figure out how to do it. If you're using an IDE, it might be hidden behind a
54+
and figure out how to do it. If you're using an IDE, it might be hidden behind a
5555
menu option or other window. Many parts of this course assume that you can
5656
interact with the interpreter.
5757

@@ -63,7 +63,7 @@ Let's take a closer look at the elements of the REPL:
6363
The `...` prompt may or may not be shown depending on your environment. For this course,
6464
it is shown as blanks to make it easier to cut/paste code samples.
6565

66-
The underscore `_` holds the last result.
66+
The underscore `_` holds the last result.
6767

6868
```python
6969
>>> 37 * 42
@@ -109,7 +109,7 @@ C:\SomeFolder>c:\python36\python hello.py
109109
hello world
110110
```
111111

112-
Note: On Windows, you may need to specify a full path to the Python interpreter such as `c:\python36\python`.
112+
Note: On Windows, you may need to specify a full path to the Python interpreter such as `c:\python36\python`.
113113
However, if Python is installed in its usual way, you might be able to just type the name of the program
114114
such as `hello.py`.
115115

@@ -265,7 +265,7 @@ Indentation groups the following statements together as the operations that repe
265265
num_bills = num_bills * 2
266266
```
267267

268-
Because the `print()` statement at the end is not indented, it
268+
Because the `print()` statement at the end is not indented, it
269269
does not belong to the loop. The empty line is just for
270270
readability. It does not affect the execution.
271271

@@ -275,7 +275,7 @@ readability. It does not affect the execution.
275275
* Use 4 spaces per level.
276276
* Use a Python-aware editor.
277277

278-
Python's only requirement is that indentation within the same block
278+
Python's only requirement is that indentation within the same block
279279
be consistent. For example, this is an error:
280280

281281
```python
@@ -464,12 +464,12 @@ NameError: name 'days' is not defined
464464
Reading error messages is an important part of Python code. If your program
465465
crashes, the very last line of the traceback message is the actual reason why the
466466
the program crashed. Above that, you should see a fragment of source code and then
467-
an identifying filename and line number.
467+
an identifying filename and line number.
468468

469469
* Which line is the error?
470470
* What is the error?
471471
* Fix the error
472472
* Run the program successfully
473473

474474

475-
[Contents](../Contents) \| [Previous (1.1 Python)](01_Python) \| [Next (1.3 Numbers)](03_Numbers)
475+
[Contents](../Contents.md) \| [Previous (1.1 Python)](01_Python.md) \| [Next (1.3 Numbers)](03_Numbers.md)

Notes/01_Introduction/03_Numbers.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[Contents](../Contents) \| [Previous (1.2 A First Program)](02_Hello_world) \| [Next (1.4 Strings)](04_Strings)
1+
[Contents](../Contents.md) \| [Previous (1.2 A First Program)](02_Hello_world.md) \| [Next (1.4 Strings)](04_Strings.md)
22

3-
# 1.3 Numbers
3+
# 1.3 Numbers
44

55
This section discusses mathematical calculations.
66

@@ -55,7 +55,7 @@ x / y Divide (produces a float)
5555
x // y Floor Divide (produces an integer)
5656
x % y Modulo (remainder)
5757
x ** y Power
58-
x << n Bit shift left
58+
x << n Bit shift left
5959
x >> n Bit shift right
6060
x & y Bit-wise AND
6161
x | y Bit-wise OR
@@ -170,7 +170,7 @@ Try it out.
170170
## Exercises
171171

172172
Reminder: These exercises assume you are working in the `practical-python/Work` directory. Look
173-
for the file `mortgage.py`.
173+
for the file `mortgage.py`.
174174

175175
### Exercise 1.7: Dave's mortgage
176176

@@ -224,7 +224,7 @@ How much will Dave pay if he pays an extra $1000/month for 4 years starting in y
224224

225225
### Exercise 1.10: Making a table
226226

227-
Modify the program to print out a table showing the month, total paid so far, and the remaining principal.
227+
Modify the program to print out a table showing the month, total paid so far, and the remaining principal.
228228
The output should look something like this:
229229

230230
```bash
@@ -264,4 +264,4 @@ True
264264
>>>
265265
```
266266

267-
[Contents](../Contents) \| [Previous (1.2 A First Program)](02_Hello_world) \| [Next (1.4 Strings)](04_Strings)
267+
[Contents](../Contents.md) \| [Previous (1.2 A First Program)](02_Hello_world.md) \| [Next (1.4 Strings)](04_Strings.md)

Notes/01_Introduction/04_Strings.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[Contents](../Contents) \| [Previous (1.3 Numbers)](03_Numbers) \| [Next (1.5 Lists)](05_Lists)
1+
[Contents](../Contents.md) \| [Previous (1.3 Numbers)](03_Numbers.md) \| [Next (1.5 Lists)](05_Lists.md)
22

33
# 1.4 Strings
44

@@ -299,7 +299,7 @@ Verify this by trying to change the first character of `symbols` to a lower-case
299299
Traceback (most recent call last):
300300
File "<stdin>", line 1, in <module>
301301
TypeError: 'str' object does not support item assignment
302-
>>>
302+
>>>
303303
```
304304

305305
### Exercise 1.14: String concatenation
@@ -408,18 +408,18 @@ To do that, use an f-string. For example:
408408
>>> price = 91.1
409409
>>> f'{shares} shares of {name} at ${price:0.2f}'
410410
'100 shares of IBM at $91.10'
411-
>>>
411+
>>>
412412
```
413413

414-
Modify the `mortgage.py` program from [Exercise 1.10](03_Numbers) to create its output using f-strings.
414+
Modify the `mortgage.py` program from [Exercise 1.10](03_Numbers.md) to create its output using f-strings.
415415
Try to make it so that output is nicely aligned.
416416

417417

418418
### Exercise 1.18: Regular Expressions
419419

420420
One limitation of the basic string operations is that they don't
421421
support any kind of advanced pattern matching. For that, you
422-
need to turn to Python's `re` module and regular expressions.
422+
need to turn to Python's `re` module and regular expressions.
423423
Regular expression handling is a big topic, but here is a short
424424
example:
425425

@@ -485,4 +485,4 @@ upper(...)
485485
>>>
486486
```
487487

488-
[Contents](../Contents) \| [Previous (1.3 Numbers)](03_Numbers) \| [Next (1.5 Lists)](05_Lists)
488+
[Contents](../Contents.md) \| [Previous (1.3 Numbers)](03_Numbers.md) \| [Next (1.5 Lists)](05_Lists.md)

Notes/01_Introduction/05_Lists.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[Contents](../Contents) \| [Previous (1.4 Strings)](04_Strings) \| [Next (1.6 Files)](06_Files)
1+
[Contents](../Contents.md) \| [Previous (1.4 Strings)](04_Strings.md) \| [Next (1.6 Files)](06_Files.md)
22

33
# 1.5 Lists
44

@@ -98,7 +98,7 @@ for name in names:
9898

9999
This is similar to a `foreach` statement from other programming languages.
100100

101-
To find the position of something quickly, use `index()`.
101+
To find the position of something quickly, use `index()`.
102102

103103
```python
104104
names = ['Elwood','Jake','Curtis']
@@ -267,7 +267,7 @@ Use the `append()` method to add the symbol `'RHT'` to end of `symlist`.
267267
>>> # append 'RHT'
268268
>>> symlist
269269
['HPQ', 'AAPL', 'AIG', 'MSFT', 'YHOO', 'GOOG', 'RHT']
270-
>>>
270+
>>>
271271
```
272272

273273
Use the `insert()` method to insert the symbol `'AA'` as the second item in the list.
@@ -411,4 +411,4 @@ example, a list that consists entirely of numbers or a list of text
411411
strings. Mixing different kinds of data together in the same list is
412412
often a good way to make your head explode so it's best avoided.
413413

414-
[Contents](../Contents) \| [Previous (1.4 Strings)](04_Strings) \| [Next (1.6 Files)](06_Files)
414+
[Contents](../Contents.md) \| [Previous (1.4 Strings)](04_Strings.md) \| [Next (1.6 Files)](06_Files.md)

Notes/01_Introduction/06_Files.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
[Contents](../Contents) \| [Previous (1.5 Lists)](05_Lists) \| [Next (1.7 Functions)](07_Functions)
1+
[Contents](../Contents.md) \| [Previous (1.5 Lists)](05_Lists.md) \| [Next (1.7 Functions)](07_Functions.md)
22

33
# 1.6 File Management
44

5-
Most programs need to read input from somewhere. This section discusses file access.
5+
Most programs need to read input from somewhere. This section discusses file access.
66

77
### File Input and Output
88

@@ -63,7 +63,7 @@ Read a file line-by-line by iterating.
6363
```python
6464
with open(filename, 'rt') as file:
6565
for line in file:
66-
# Process the line
66+
# Process the line
6767
```
6868

6969
### Common Idioms for Writing to a File
@@ -168,7 +168,7 @@ of column headers).
168168
>>>
169169
```
170170

171-
`next()` returns the next line of text in the file. If you were to call it repeatedly, you would get successive lines.
171+
`next()` returns the next line of text in the file. If you were to call it repeatedly, you would get successive lines.
172172
However, just so you know, the `for` loop already uses `next()` to obtain its data.
173173
Thus, you normally wouldn’t call it directly unless you’re trying to explicitly skip or read a single line as shown.
174174

@@ -234,12 +234,12 @@ Data scientists are quick to point out that libraries like
234234
[Pandas](https://pandas.pydata.org) already have a function for
235235
reading CSV files. This is true--and it works pretty well.
236236
However, this is not a course on learning Pandas. Reading files
237-
is a more general problem than the specifics of CSV files.
237+
is a more general problem than the specifics of CSV files.
238238
The main reason we're working with a CSV file is that it's a
239239
familiar format to most coders and it's relatively easy to work with
240240
directly--illustrating many Python features in the process.
241241
So, by all means use Pandas when you go back to work. For the
242242
rest of this course however, we're going to stick with standard
243243
Python functionality.
244244

245-
[Contents](../Contents) \| [Previous (1.5 Lists)](05_Lists) \| [Next (1.7 Functions)](07_Functions)
245+
[Contents](../Contents.md) \| [Previous (1.5 Lists)](05_Lists.md) \| [Next (1.7 Functions)](07_Functions.md)

Notes/01_Introduction/07_Functions.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[Contents](../Contents) \| [Previous (1.6 Files)](06_Files) \| [Next (2.0 Working with Data)](../02_Working_with_data/00_Overview)
1+
[Contents](../Contents.md) \| [Previous (1.6 Files)](06_Files.md) \| [Next (2.0 Working with Data)](../02_Working_with_data/00_Overview.md)
22

33
# 1.7 Functions
44

@@ -41,15 +41,15 @@ import math
4141
x = math.sqrt(10)
4242

4343
import urllib.request
44-
u = urllib.request.urlopen('http://www.python.org/')
44+
u = urllib.request.urlopen('http://www.python.org/')
4545
data = u.read()
4646
```
4747

4848
We will cover libraries and modules in more detail later.
4949

5050
### Errors and exceptions
5151

52-
Functions report errors as exceptions. An exception causes a function to abort and may
52+
Functions report errors as exceptions. An exception causes a function to abort and may
5353
cause your entire program to stop if unhandled.
5454

5555
Try this in your python REPL.
@@ -130,7 +130,7 @@ Try typing a command such as `help(greeting)` to see it displayed.
130130

131131
### Exercise 1.30: Turning a script into a function
132132

133-
Take the code you wrote for the `pcost.py` program in [Exercise 1.27](06_Files)
133+
Take the code you wrote for the `pcost.py` program in [Exercise 1.27](06_Files.md)
134134
and turn it into a function `portfolio_cost(filename)`. This
135135
function takes a filename as input, reads the portfolio data in that
136136
file, and returns the total cost of the portfolio as a float.
@@ -278,4 +278,4 @@ Total cost: 44671.15
278278
bash %
279279
```
280280

281-
[Contents](../Contents) \| [Previous (1.6 Files)](06_Files) \| [Next (2.0 Working with Data)](../02_Working_with_data/00_Overview)
281+
[Contents](../Contents.md) \| [Previous (1.6 Files)](06_Files.md) \| [Next (2.0 Working with Data)](../02_Working_with_data/00_Overview.md)

Notes/02_Working_with_data/00_Overview.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ lists, sets, and dictionaries and discusses common data handling
66
idioms. The last part of this section dives a little deeper
77
into Python's underlying object model.
88

9-
* [2.1 Datatypes and Data Structures](01_Datatypes)
10-
* [2.2 Containers](02_Containers)
11-
* [2.3 Formatted Output](03_Formatting)
12-
* [2.4 Sequences](04_Sequences)
13-
* [2.5 Collections module](05_Collections)
14-
* [2.6 List comprehensions](06_List_comprehension)
15-
* [2.7 Object model](07_Objects)
9+
* [2.1 Datatypes and Data Structures](01_Datatypes.md)
10+
* [2.2 Containers](02_Containers.md)
11+
* [2.3 Formatted Output](03_Formatting.md)
12+
* [2.4 Sequences](04_Sequences.md)
13+
* [2.5 Collections module](05_Collections.md)
14+
* [2.6 List comprehensions](06_List_comprehension.md)
15+
* [2.7 Object model](07_Objects.md)
1616

17-
[Contents](../Contents)
17+
[Contents](../Contents.md)

Notes/02_Working_with_data/01_Datatypes.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[Contents](../Contents) \| [Previous (1.6 Files)](../01_Introduction/06_Files) \| [Next (2.2 Containers)](02_Containers)
1+
[Contents](../Contents.md) \| [Previous (1.6 Files)](../01_Introduction/06_Files.md) \| [Next (2.2 Containers)](02_Containers.md)
22

33
# 2.1 Datatypes and Data structures
44

@@ -242,7 +242,7 @@ shares and the price:
242242
```
243243

244244
Is math broken in Python? What’s the deal with the answer of
245-
3220.0000000000005?
245+
3220.0000000000005?
246246

247247
This is an artifact of the floating point hardware on your computer
248248
only being able to accurately represent decimals in Base-2, not
@@ -446,4 +446,4 @@ dict_items([('name', 'AA'), ('shares', 75), ('price', 32.2), ('date', (6, 11, 20
446446
>>>
447447
```
448448

449-
[Contents](../Contents) \| [Previous (1.6 Files)](../01_Introduction/06_Files) \| [Next (2.2 Containers)](02_Containers)
449+
[Contents](../Contents.md) \| [Previous (1.6 Files)](../01_Introduction/06_Files.md) \| [Next (2.2 Containers)](02_Containers.md)

0 commit comments

Comments
 (0)