This Is Not The Course Website You Are Looking For

This course website is from a previous semester. If you are currently in the class, please make sure you are viewing the latest course website instead of this old one.

Everyone:

Next week, we will have Exam 02, which will cover scripting in Python with a focus on: data structures, functional programming, and concurrency and parallelism. This reading assignment is meant to prepare you for this exam and is based on the items in Checklist 02.

Because of the exam on Wednesday, March 16, there will be no homework for the upcoming week.

TL;DR

The focus of this reading is to allow you to review for Exam 02.

Readings

The readings for this week are:

  1. Checklist 02

Quiz

This week, the reading is split into two sections: the first part is a short dredd quiz, while the second part involves four short Python scripts: translate1.py, translate2.py, translate3.py, and translate4.py.

To test these scripts, you will need to download the Makefile and test scripts:

$ git checkout master                 # Make sure we are in master branch
$ git pull --rebase                   # Make sure we are up-to-date with GitHub

$ git checkout -b reading08           # Create reading08 branch and check it out

$ cd reading08                        # Go into reading08 folder

# Download Reading 08 Makefile
$ curl -LO https://raw.githubusercontent.com/nd-cse-20289-sp22/cse-20289-sp22-assignments/master/reading08/Makefile

# Download and execute scripts
$ make

Code Snippets

Record the answers to the following Reading 08 Quiz questions in your reading08 branch:

Translations

Given the following Unix pipelines, write Python scripts (ie. translateX.py) that accomplishes the same task.

  1. translate1.py: grep -Po ':1\d*0:' /etc/passwd | wc -l

  2. translate2.py: /bin/ls -ld /etc/* | awk '{print $4}' | sort | uniq

  3. translate3.py: curl -sLk http://yld.me/raw/fDIO | cut -d , -f 4 | grep -Eo '^M.*' | sort

  4. translate4.py: cat /etc/passwd | cut -d : -f 7 | sort | uniq -c | sort -srn

Notes

Submission

To submit you work, follow the same process outlined in Reading 01:

$ git checkout master                 # Make sure we are in master branch
$ git pull --rebase                   # Make sure we are up-to-date with GitHub

$ git checkout -b reading08           # Create reading08 branch and check it out

$ cd reading08                        # Go into reading08 folder

$ $EDITOR answers.json                # Edit your answers.json file

$ ../.scripts/check.py                # Check reading08 quiz
Checking reading08 quiz ...
     Q01 0.20
     Q02 0.20
     Q03 0.20
     Q04 0.20
     Q05 0.20
     Q06 0.20
     Q07 0.20
     Q08 0.20
     Q09 0.20
     Q10 0.20
   Score 2.00 / 2.00
  Status Success

$ git add answers.json                # Add answers.json to staging area
$ git commit -m "Reading 08: Quiz"    # Commit work

$ $EDITOR translate1.py               # Edit your translate1.py file
$ $EDITOR translate2.py               # Edit your translate2.py file
$ $EDITOR translate3.py               # Edit your translate3.py file
$ $EDITOR translate4.py               # Edit your translate4.py file

$ make                                # Test all scripts
Testing translations ...
 translate1.py                            ... Success
 translate2.py                            ... Success
 translate3.py                            ... Success
 translate4.py                            ... Success

   Score 2.00 / 2.00
  Status Success

$ git add Makefile                    # Add Makefile to staging area
$ git add translate1.py               # Add translate1.py to staging area
$ git add translate2.py               # Add translate2.py to staging area
$ git add translate3.py               # Add translate3.py to staging area
$ git add translate4.py               # Add translate4.py to staging area
$ git commit -m "Reading 08: Scripts" # Commit work

$ git push -u origin reading08        # Push branch to GitHub

Pull Request

Remember to create a Pull Request and assign the appropriate TA from the Reading 08 TA List.

DO NOT MERGE your own Pull Request. The TAs use open Pull Requests to keep track of which assignments to grade. Closing them yourself will cause a delay in grading and confuse the TAs.