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.
Installing Python 3.7
-
Go to https://www.anaconda.com/distribution/#download-section
Select your operating system.
- Download the 3.7 version of the 64-Bit graphical installer, and start it. Make sure you check "Add Python to $PATH" if asked. Do not install PyCharm if asked Check "Disable path limit" if asked
Installing Atom Editor
-
Go to https://atom.io and download Atom.
Run Atom
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)
script
and install it.
Writing your first program
-
Make sure Atom is still running
Create a new scrpt (File > New File)
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
).
Type: print('Hello world')
in the script.
Run the code by pressing Ctrl+Shift+B
on Windows (or ⌘I
on a Mac).
Do you see something like this? 
python is not a recognized command
, you will need to add python to your system path. To do it, -
go to your command line (
Win+R
then type cmd
and press Enter.)
type setx path "%path%;C:\Users\YOUR_USERNAME\Anaconda3"
but replace YOUR_USERNAME
with your actual username.
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.
Open Registry Editor, and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
.
Modify the Path
variable to add C:\Users\YOUR_USERNAME\Anaconda3
at the end of it.
Confirm and restart your computer, try with Atom again.
Preparing your program for submission
-
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
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:
hello_name.py
in the same folder as your hello_world.py
file.
Modify the code to write a program that prints your name (you can also print your preferred pronoun):
''' DS2000 Fall 2019 PR01 - hello world, my name is... ''' # ENTER CODE BELOW THIS LINE (1-2 lines) # ENTER CODE ABOVE THIS LINEMake sure that the program runs with no errors and prints what you intended. Zip (compress) the folder that hass your
hello_world.py
and hello_name.py
files and submit your practicum code to Blackboard.
Reading
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.
(c) Piotr Sapiezynski, 2019