|
1 |
| -### Exercises for [Real Python's](https://realpython.com) *"Python Basics: A Practical Introduction to Python 3"* Book |
| 1 | +# Exercises for [Real Python's](https://realpython.com) *"Python Basics: A Practical Introduction to Python 3"* Book |
| 2 | + |
| 3 | +## Downloading the Files |
| 4 | + |
| 5 | +### With `git` |
| 6 | + |
| 7 | +If you have `git` installed, the easiest way to access these files is to clone the repository to the directory of your choice: |
| 8 | + |
| 9 | +```console |
| 10 | +$ git clone https://github.com/realpython/python-basics-exercises.git |
| 11 | +``` |
| 12 | + |
| 13 | +Then `cd` into the `itertools-in-python3` directory: |
| 14 | + |
| 15 | +```console |
| 16 | +$ cd materials/itertools-in-python3 |
| 17 | +``` |
| 18 | + |
| 19 | +### Without `git` |
| 20 | + |
| 21 | +Alternatively, you can download the entire repository as a `.zip` file from the repository's [homepage](https://github.com/realpython/materials) using the green "Clone or download" button in the top right hand corner. |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +## Running the Code Examples |
| 26 | + |
| 27 | +To run the code examples, first make sure you have Python 3 installed on your machine. **The code examples WILL NOT work with Python 2.** If you need help installing Python 3, check out Real Python's [Python 3 Installation & Setup Guide](https://realpython.com/installing-python/). |
| 28 | + |
| 29 | +To run the `sp500.py` file, type `python3 sp500.py` into your terminal. Here's how that looks, with output: |
| 30 | + |
| 31 | +```console |
| 32 | +$ python3 sp500.py |
| 33 | +Max gain: 11.58% on 2008-10-13 |
| 34 | +Max loss: -20.47% on 1987-10-19 |
| 35 | +Longest growth streak: 14 days (1971-03-26 to 1971-04-15) |
| 36 | +``` |
| 37 | + |
| 38 | +> **Note:** Depending on your installation, you may need to type `python3.6` or `python36` to run the examples. If you follow the [Python 3 Installation & Setup Guide](https://realpython.com/installing-python/), you should have no problem. |
| 39 | +
|
| 40 | +Similarly, for `swimmers.py`: |
| 41 | + |
| 42 | +```console |
| 43 | +$ python3 swimmers.py |
| 44 | +Backstroke A: Sophia, Grace, Penelope, Addison |
| 45 | +Backstroke B: Elizabeth, Audrey, Emily, Aria |
| 46 | +Breaststroke A: Samantha, Avery, Layla, Zoe |
| 47 | +Breaststroke B: Lillian, Aria, Ava, Alexa |
| 48 | +Butterfly A: Audrey, Leah, Layla, Samantha |
| 49 | +Butterfly B: Alexa, Zoey, Emma, Madison |
| 50 | +Freestyle A: Aubrey, Emma, Olivia, Evelyn |
| 51 | +Freestyle B: Elizabeth, Zoe, Addison, Madison |
| 52 | +``` |
| 53 | + |
| 54 | +# TODO: Adapt for Python Basics |
0 commit comments