Skip to content

Commit 178bbe7

Browse files
committed
a bit of clarification and simiplification
1 parent 2f5ed8e commit 178bbe7

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

source/examples/file_exercise/students.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Mitchell, Joni: php, mysql, python
2323
Ramone, John: Johnny, rex, db
2424
King, Carol: r
2525
Waters, Muddy: perl, python
26-
Star, Richard: Ringo, Tom, shell, python, vb
27-
Smith, Patricia: Patti, Gene, python
26+
Star, Richard: Ringo, shell, python, vb
27+
Smith, Patricia: Patti, python
2828
Morrison, Jim: fortran, perl, sql, python
2929
Marley, Robert: Bob, c, c++, lisp
3030
Simon, Paul: bash, python, sql

source/exercises/file_lab.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@ Paths and File Processing
1616
=========================
1717

1818
* Write a program which prints the full path for all files in the current
19-
directory, one per line
19+
directory, one per line. Use either the ``os`` module or ``pathlib``.
2020

2121
* Write a program which copies a file from a source, to a destination
22-
(without using shutil, or the OS copy command).
23-
24-
- Advanced: make it work for any size file: i.e. don't read the entire
25-
contents of the file into memory at once.
22+
(without using shutil, or the OS copy command (you are essentially writing a simple version of the OS copy command)).
2623

2724
- This should work for any kind of file, so you need to open
2825
the files in binary mode: ``open(filename, 'rb')`` (or ``'wb'`` for
@@ -31,6 +28,9 @@ Paths and File Processing
3128

3229
- Test it with both text and binary files (maybe a jpeg or something of your choosing).
3330

31+
- Advanced: make it work for any size file: i.e. don't read the entire
32+
contents of the file into memory at once.
33+
3434
- This should only be a few lines of code :-)
3535

3636

@@ -43,9 +43,9 @@ Download this text file:
4343

4444
In it, you will find a list of names and what programming languages they have used in the past. This may be similar to a list generated at the beginning of this class.
4545

46-
Write a little script that reads that file, and generates a list of all the languages that have been used.
46+
Write a little script that reads that file and generates a list of all the languages that have been used.
4747

48-
What might be the best data structure to use to keep track of bunch of values without duplication?
48+
What might be the best data structure to use to keep track of bunch of values (the languages) without duplication?
4949

5050
The file format:
5151
----------------
@@ -62,5 +62,7 @@ So a colon after the name, then the nickname, and then one or more languages.
6262

6363
However, like real data files, the file is NOT well-formed. Only some lines have nicknames, and other small differences, so you will need to write some code to make sure you get it all correct.
6464

65+
How can you tell the difference between a nickname and a language?
66+
6567
Extra challenge: keep track of how many students specified each language.
6668

0 commit comments

Comments
 (0)