Now You Code 1: Funny Names

Write a program to

  1. read the file NYC1-funnynames.txt into a list, by completing the provided user-defined function
  2. sort the list of names
  3. print the list of names one name per line.

Sample Program Output:

Alma Frienzergon
Kent Belevit
Mitch Again
Oliver Stuffismisson
Sandi Shores
Sarah Bellum
Willie Pas-D'course
Yolanda Ismyland

Step 1: Problem Analysis for read_names user-defined function

Inputs: None

Outputs: a list of names

Algorithm (Steps in Program):


In [ ]:
# Step 2: write function
# this function reads from "NYC-funnynames.txt" places the names in a list.
# program should return a list of names
def read_names():
    names = []
    #todo write code here

Step 3: Problem Analysis for entire program

Inputs:

Outputs:

Algorithm (Steps in Program):


In [2]:
## Step 4: write entire program making sure to use read_names

Step 5: Questions

  1. Does writing the read_names function clarify the intent of the main program in step 4? Why or why not?

Answer:

  1. Find the NYC-funnynames.txt file in your lessons/09 folder. Open the file and add the name Euron Trouble to the file, then save and close it. Re-run the program in step 4. Do you see the new name in the program output? Explain why or why not?

Answer:

Step 6: Reflection

Reflect upon your experience completing this assignment. This should be a personal narrative, in your own voice, and cite specifics relevant to the activity as to help the grader understand how you arrived at the code you submitted. Things to consider touching upon: Elaborate on the process itself. Did your original problem analysis work as designed? How many iterations did you go through before you arrived at the solution? Where did you struggle along the way and how did you overcome it? What did you learn from completing the assignment? What do you need to work on to get better? What was most valuable and least valuable about this exercise? Do you have any suggestions for improvements?

To make a good reflection, you should journal your thoughts, questions and comments while you complete the exercise.

Keep your response to between 100 and 250 words.

--== Write Your Reflection Below Here ==--