Week 2 - Review of Week 1


Let's review what we learned last week:

  1. Installed python
  2. Three ways to run a python program (for now)
  3. Writing our first program

1. Installed python:

We downloaded the Continuum Analytics Anaconda distribution for Python 3.5 and installed it. The installer can be found here:

https://www.continuum.io/downloads

There were some problems:

  1. Unable to launch Juypter Notebook from Navigator? Try deleting the Jupyter Notebook from Navigator and re-installing it.
  2. Not able to launch Navigator? Try deleting Anaconda folder and reinstalling.
  3. Type "jupyter notebook" in the Terminal or command prompt.
  4. Still not able to launch Juypter Notebook? Cannot find jupyter? try launching by running:
     /Users/your_user_name/anaconda/bin/jupyter notebook

2. Three ways to run a python program (for now)

We could start python by:

  1. From the command-line

    1. Openning a Terminal (Mac, Linux) or teh Command Prompt (Windows)
    2. Typing "python"
    3. We can confirm this by observing the three greater-than signs together ">>>"
    4. Remember to exit we had to use:

      exit()

  2. Use a text file

    1. Open a text editor (Mac: Textedit, TextWrangler; Win: Notepad; NOTE: Not Microsoft Word)
    2. Type our python statement in:
       print("Hello world")
    3. Save the file as "hello_world.py"
    4. Run the python script from the command line using:
       python hello_world.py
  3. Run your python code as a code cell within a Jupyter Notebook. d

    1. Open Jupyter Notebook
    2. Create a new notebook with a python 3 kernel (should be "Python [Root]" if you installed the python 3.5 version of anaconda installer.
    3. Type you code in a new code cell
    4. Run cell

3. Writing our first program

Lets look at the homework


In [ ]: