Lab 1: Learning Python
In this lab you will learn the basics of a programming language
called Python. You will also learn about how to use Jupyter
notebooks to execute Python code.
Download the necessary software
- Download Python 3.11.4 for the mac
- From this site, select "Downloads", then "macOS", and click on the button.
- Choose to save the file to your Desktop.
- Follow the prompts to install the software.
- At the end you should see a congratulations message that it was successfully installed.
- You can move the installer to the trash.
- Add the terminal application to the dock of your mac.
- Test that python is working:
- Open the terminal application.
- Inside the terminal window type: python3
- This should open the python interpreter, and you should see a new prompt like this: >>>
- At the python prompt, try a simple command, such as 2+3, and press return, it should print 5
- To exit python, type: exit() press return.
- Type the following commands within the terminal:
- pip3 install jupyter
- pip3 install pandas
- pip3 install matplotlib
Gettting Started
- Create a new folder called S3P on the Desktop of your Macbook Air.
- This link will download a Jupyter
Notebook to your computer; save
it in S3P folder that you just created.
- Open a terminal window and type: cd Desktop/S3P. This puts you inside the folder you just created.
- Then in the terminal window type: python3 -m
notebook to start working in Jupyter notebook.
- Double click on the file
named IntroToPython.ipynb. This is a notebook you
will use to learn some Python programming.
- Read through this notebook, executing the cells, and complete the exercises that are given.