This commit is contained in:
David Beazley
2020-05-24 19:39:08 -05:00
parent 81d411c94d
commit 4ea53cbadd
7 changed files with 35 additions and 22 deletions

View File

@@ -1,8 +1,8 @@
# 1.1 Python
In this part, we'll start with the absolute basics.
In this part, we'll start with the absolute basics of Python.
## Notes
## Reading
### What is Python?

View File

@@ -1,6 +1,9 @@
# 1.2 A First Python Program
## Notes
This section discusses the creation of your first program, running the interpreter,
and some basic debugging.
## Reading
### Running Python

View File

@@ -1,6 +1,8 @@
# 1.3 Numbers and Booleans
# 1.3 Numbers
## Notes
This section covers some basics of performing mathematical calculations in Python.
## Reading
### Types of Numbers

View File

@@ -1,6 +1,8 @@
# 1.4 Strings
## Notes
This section covers the basics of text manipulation.
## Reading
### Representing Text

View File

@@ -1,10 +1,20 @@
# 1.5 Lists
## Notes
This section introduces lists, one of Python's basic objects for storing collections of data.
### String Splitting
## Reading
Strings can represent fields of data. We can work with each field by splitting the string into a list.
### Creating a List
Use square brackets to create a list:
```python
names = [ 'Elwood', 'Jake', 'Curtis' ]
nums = [ 39, 38, 42, 65, 111]
```
Sometimes lists are created by other methods. For example, a string can be split into a
list using the `split()` method:
```pycon
>>> line = 'GOOG,100,490.10'
@@ -14,18 +24,9 @@ Strings can represent fields of data. We can work with each field by splitting t
>>>
```
A common use case for this splitting is when reading data from a file. You might read each line as text and then split the text into columns.
### List operations
Use square brackets to create a list:
```python
names = [ 'Elwood', 'Jake', 'Curtis' ]
nums = [ 39, 38, 42, 65, 111]
```
It can hold items of any type. Add a new item using `append()`:
Lists can hold items of any type. Add a new item using `append()`:
```python
names.append('Murphy') # Adds at end
@@ -84,7 +85,7 @@ s = [1, 2, 3]
s * 3 # [1, 2, 3, 1, 2, 3, 1, 2, 3]
```
### List Iteration & Search
### List Iteration and Search
Iterating over the list contents.

View File

@@ -1,6 +1,8 @@
# 1.6 File Management
## Notes
This section discusses the basics of working with files.
## Reading
### File Input and Output

View File

@@ -1,6 +1,9 @@
# 1.7 Introduction to Functions
## Notes
As your programs start to get larger, you'll want to get organized. This section
introduces functions. Error handling with exceptions is also introduced.
## Reading
### Custom Functions