CSCI 141 - Lab 8

Scott Wehrwein

Winter 2023

Introduction

In this lab, you’ll write a program to read historical earthquake data from a file and plot each earthquake on a map using turtle graphics. An example output is shown here:

The output from my solution code.

Setup

Create a lab8 directory in your lab environment of choice. Download the following files from the course webpage and place them in your lab8 folder:

Approach and Guidelines

Implement the parse_row function and the remainder of the main function according to the pseudocode included in comments. Follow the same coding style conventions we’ve been using up to this point: comment at the top, good variable naming, and so on.

You’ll find that you need many of the structures and concepts we’ve covered in this course to complete this task - ask your TA if you encounter any problems, and use this opportunity to take note of any topics you need to brush up on before the final exam.

Some hints:

Submission

Take a screenshot of your program’s output and save it as earthquakes.png. Submit earthquakes.png and plot_earthquakes.py to Canvas.

Rubric

This lab is graded out of 30 points:

Challenge - Anagrams

An anagram of a word is a different word spelled using the same letters. For instance, “elbow” is an anagram of “below”. For purposes of this problem, we’ll consider only anagrams that use exactly the same letters, without leaving any out or repeating letters more times than they appear in the original word. For example, “bow” and “bellow” are not considered anagrams of “below” for purposes of this problem.

Download words.txt and write a program that finds the largest set of 6-letter words that are all anagrams of each other. As an example, among 3-letter words, there are two sets that tie for largest: [’tea’, ’eat’, ’eta’, ’ate’] and [’aer’, ’ear’, ’are’, ’era’].

My program is able to find the three-letter sets in a second or two on my laptop. Finding the 6-letter set takes a little longer - around 45 seconds. I didn’t import any modules from the standard library, but you may if you’d like—itertools might be particularly helpful. For the sake of efficiency, you may want do some thinking and/or research into what kind of collection you store things in; lists may not always be the best choice.

Name your program anagram.py and submit it to Canvas for up to 2 points of extra credit. One point is awarded for a correct solution; the second point is awarded for solving it without importing any modules.