warmup 4.htm.pdf - COM110 Fall 2014 Warm-up exercise 4 Due...

Info icon This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: COM110 Fall 2014 Warm-­‐up exercise 4 Due Wed, Sept 17 In your chapter 5 reading you learned various ways to read in text from a file. In sec;on 5.9.3 you wrote a program that creates usernames for a whole list of students (using the data file of student names I provided for you: classlist.txt). a) Test the program, make sure it indeed generates a new file (in the same place where you have saved your userfile.py program) with the list of automa;cally generated usernames. (One way to troubleshoot things if it’s not working is to add print statements as needed throughout the code to check what each variable holds.) b) Modify the program so that in addi;on to wri;ng each student’s username to the output file, it also counts how many students there are (i.e., counts the number of lines in the file). c) Test the line-­‐coun;ng code you wrote in part (b) by wri;ng a separate module that reads in the poem in this text file and similarly counts the number of lines in it. ...
View Full Document

  • Fall '15
  • Cannon

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern