read text files

icon picker
council names

read a file of text values, find max/min values, count occurrences
@council names
(text values in a text file)

Text Files

One or more lines of text, each separated by a newline (\n) :
The key file operations are required:
open a file
read from a file
close a file
Examine the text file, it contains the names of all 32 Scottish Councils.
Each council name is displayed on a new line.
Examine the code.
Compare the code with the description in codeClips.
Make sure you know what code is used to open, read and close the file.

requirement challenges

What is the longest council name?
What is the shortest council name?
How many councils end in the letters "shire"?
How many councils names start with a compass direction?
reuse code for standard algorithms to solve the challenges.

project code


Loading…

avoid looking at the sample code before attempting the project first

sample finished code


The key file operations are demonstrated:
open a file
read from a file
close a file
The text file contains the names of all 32 Scottish Councils.
Each council is displayed on a new line.
You will know what code is used to open, read and close the file.

Loading…
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.