-
Notifications
You must be signed in to change notification settings - Fork 46
ExerciseSession1 Basics
Katy Huff edited this page Feb 21, 2012
·
2 revisions
In this exercise session you will :
- Create your own github repository
- Fork the repository of a friend
- Navigate the shell
- Manipulate strings, files, and integers
- Write your own bona fide python program
It's so easy. Name it ExcerciseSession .
Just login and follow [[the instructions. | http://help.github.com/create-a-repo/]]
Start with a .py file that will contain your solution program.
You may want to start by defining a main() function.
The text files you reorganized in the shell session should be in a single directory and should all have the extension .txt.
- Create a function that finds all of the filenames and puts them in a list. ( hint: import os, glob ).
- Create a function that, given a line from a file, returns true if that line contains a question with an N response and false otherwise.
- Create a function that, given the filename and the line that has a missing response, fixes the missing entry by appending that line with a default answer of gender M.
- Use these functions together (probably within the main function) to create a loop that, for each file in the file list, reads each line, determines whether it is missing a response, and if it is, fixes the missing entry in place within the files.
Be sure to commit your changes often and occasionally push your commits to your repository, especially when your solution is complete.
I'll share my solution at the end of the session.
Fork their repository, check their solution, and improve something.
Push your improvement to your fork of their repository.