# Day 5

## Class Visitors

Software Design is a class at Olin that welcomes visitors from time to time. We have faculty, staff, prospective students, and external visitors. If we are in open studio time, we encourage the visitors to talk to people working at different tables. Thanks for helping us show the SoftDes magic with others. Today, we are joined by Dr. Karl W. Reid, Executive Director of the National Society of Black Engineers.

## MP1 Week 1 Debrief

A few notes on what we’ve seen so far

The complete MP1 (including additional unit tests and analysis of your findings) is due on Tuesday. Please reach out to course staff if you have any questions.

Going Beyond: try to use list comprehensions in the second part of the assignment.

In the reading, we learned a variety of useful commands:

• ls
• pwd, cd
• cp, mv
• rm, rmdir
• sudo
• (and cat, more/less, wget, grep, sed …)

as well as concepts like:

• tab file name completion
• output redirection with | and >
• quitting with Control-c

If any of these look unfamiliar to you, jump back to the reading for a refresher. You can also run man pwd to look at the ‘man’ual page for the pwd command or any other command you see that you want to review.

The man command is a great built-in feature but can sometimes be an intimidating information dump.

We also learned that working in the command line is powerful, but comes with no “undo” functionality. If you’d like to give yourself a bit of a safety net when running commands like rm, read on to sections 2.11-2.12 to see how to make those commands ask for confirmation first.

Talk to people at your table about how you approached the is_anagram prompt.

As a class, we’ll discuss the similar functions you saw spanning the last two reading journals: middle and chop. These simple functions illustrate a wealth of important (and sometimes tricky) Python concepts:

• mutable vs immutable objects
• pure function vs modifier
• aliasing
• equivalent vs identical object comparison

As we discussed last time, state and stack diagrams are extremely useful for reasoning about code, especially with mutable objects like lists. We can use Python Tutor to visualize the difference between middle and chop.

It’s also probably handy to keep the set of Python list methods in your back pocket.

## Iteration

Quick check: Compare and contrast lists and strings

One thing they have in common are that both are “iterables” - we can iterate over all the characters of a string or over all the elements of a list.

Read about iteration design patterns. Some of the concepts covered are a bit more advanced and you don’t need to do everything, but it’s a useful reference. Don’t forget to practice active reading with hands on keyboards trying things out!

This reading is a Jupyter notebook, and the link to the source code is down at the bottom. Download that file and save it locally so you can edit and run cells.

Exercise

Which iteration patterns does the grocery store receipt program you wrote last time use? Rewrite it to use another coding style that you learned about in the reading.