Momentum logo
Team 5 Classroom

Python Setup

Posted on Oct 6th, 2020

Great work this morning, y’all. Here’s the instructions for getting Python set up correctly and installing exercism, as well as some helpful notes and links.

Install exercism

Open a terminal and enter the following command verbatim (the && chains commands together, but only if the first one doesn’t fail):

brew update && brew install exercism

Exercism is a great tool we’ll be using for doing warmup and learning exercises.

Install pipenv

Open a terminal and enter the following command verbatim:

brew install pipenv

pipenv is a package management tool that will simplify the task of organizing complex Python projects.

Get to know Python

I’m including a few links to good beginner resources for anyone who’s eager to get started.

Quick note on Python 2 vs Python 3

There are two major versions of Python in common use – Python 2 and Python 3. Python 2 is no longer updated and support is being withdrawn, but because MacOS uses Python 2 in a few places, Python 2 is the default version. This is annoying and complicates things somewhat, but isn’t too difficult to navigate around – if you’re trying out code you found on the internet, and it says (for example):

python a_python_script.py

you should instead run:

python3 a_python_script.py

There are a couple of other places where you may need to run slightly different commands, but I’ll only go over one of them right now; if you try some of the exercism.io exercises this weekend, it may tell you to run:

pytest hello_world_test.py

Instead, you should run:

python3 -m pytest hello_world_test.py

(of course, hello_world_test.py could be any Python file).

Word Frequency Assignment Link

Posted on Oct 6th, 2020

Assignment Description

  • In this assignment, you’ll write a simple script that will count the occurrence of words in a text file. Two text-files are included with the assignment for testing, but you may want to create others to use for additional test cases.
  • This assignment will take place over several days, and we haven’t covered everything that will be required to complete the assignment.
  • To learn more about the most important topics we haven’t covered, check out the topic links below.