Home Practicum 1 Practicum 2 Practicum 3

Welcome to DS2000 CS practicum!

Today we'll make sure you have the software necessary to start learning Python and we'll write our first program in Python! If you're interested in the papers or code that I talked about in the intro, you can download the slides. Now, let's get started.

  1. Installing Python 3.7
  2. Writing your first program
  3. Preparing your program for submission

Installing Python 3.7

  1. Go to https://www.anaconda.com/distribution/#download-section
  2. Select your operating system.
  3. Download the 3.7 version of the 64-Bit graphical installer, and start it.
  4. Make sure you check "Add Python to $PATH" if asked.
  5. Do not install PyCharm if asked
  6. Check "Disable path limit" if asked

Installing Atom Editor

  1. Go to https://atom.io and download Atom.
  2. Run Atom
  3. In Atom enable the following option:
    • Windows: File > Settings > Editor > Invisibles > Enable invisibles (or Show invisibles)
    • mac OS: Atom > Preferences > Editor > Invisibles > Enable invisibles (or Show invisibles)
  4. Still in Settings (or Preferences) go to Install pane, search for package called script and install it.

Writing your first program

  1. Make sure Atom is still running
  2. Create a new scrpt (File > New File)
  3. Save the file as hello_world.py (do not save it directly in documents. Create a folder structure intead, for example Documents/DS2001/pr01/hello_world.py).
  4. Type: print('Hello world') in the script.
  5. Run the code by pressing Ctrl+Shift+B on Windows (or ⌘I on a Mac).
  6. Do you see something like this?
  7. If yes, congratulations, you ran your first program! If you get an error message, it's not a big deal! All programmers constantly get errors. Learning how to read and understand the error messages is an important part of programming. Please ask the professor or the teaching assistant for help.
  8. If you're on Windows and the error you get is along the lines of python is not a recognized command, you will need to add python to your system path. To do it,
    1. go to your command line (Win+R then type cmd and press Enter.)
    2. type setx path "%path%;C:\Users\YOUR_USERNAME\Anaconda3" but replace YOUR_USERNAME with your actual username.
    3. if you don't see a message that mentions the path being truncated, try running your code in Atom, otherwise go to the next step.
    4. Open Registry Editor, and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment.
    5. Modify the Path variable to add C:\Users\YOUR_USERNAME\Anaconda3 at the end of it.
    6. Confirm and restart your computer, try with Atom again.

Preparing your program for submission

  1. The top lines of a python script can be used to leave comments about what this file is (for example, a submission to the first practicum). Longer comments start and end with three ' characters
  2. Inside the code you can also use single line comments by starting the line with a # character for example to explain to yourself and others reading your code what the next line or section is supposed to do, see here:
  3. Copy and paste the code below to a new .py file and save it as hello_name.py in the same folder as your hello_world.py file.
  4. Modify the code to write a program that prints your name (you can also print your preferred pronoun):
    Fall 2019
    PR01 - hello world, my name is...
    # ENTER CODE BELOW THIS LINE (1-2 lines)
  5. Make sure that the program runs with no errors and prints what you intended.
  6. Zip (compress) the folder that hass your hello_world.py and hello_name.py files and submit your practicum code to Blackboard.


After you setup python and submitted to blackboard, please read this article https://www.fast.ai/2019/01/29/five-scary-things/. We will discuss it during the next class.