Session 4, #4: Looping Through Files


With large lists, it's often easier to read from a file stored (we'll do that with the earthquake data). Here's a program that reads in colors from a file:

We can control which file is used, by changing the input to the open() command. There are two files of colors already loaded, colorList and colors2. Change your program to use the second file, colors2 and run it.


Challenge: Make a new file of colors. To create a file, click on the + button. Write one color per line (color names) and make sure to change the main program to open your new file.