Web Addresses List¶
Objects are nice, but they’re even better when used with a list.
The code provided does the same as the previous assignment, but uses an array of objects, instead of one variable for each record.
Files Needed¶
What You Should See¶
1. 191 Marigold Lane, Miami, FL 33179
2. 3029 Losh Lane, Crafton, PA 15205
3. 4939 Holt Street, Lake Worth, FL 33463
4. 2693 Hannah Street, Hickory, NC 28601
5. 4880 Carter Street, Fairview Heights, IL 62208
What You Should Do on Your Own¶
Assignments turned in without these things will receive half credit or less.
The code provided counts up to
18
in the first loop instead of using thelen()
function on the listfile_lines
. Fix this.The code is also using the value
5
to print out theaddresses
list. Use thelen()
function on that list too for that loop. Ensure that all six addresses are read in.What happens if you simply print the
address
variable? In your loop, print outprint(address)
and observe. What do you suppose it might mean? Wouldn’t it be nice if, when you print the variable directly, it would display something more intelligible? We will take care of that in the next exercise.
©2021 Daniel Gallo
This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Adapted for Python from Graham Mitchell’s Programming By Doing