Intro to

Fall 2020

chapter 5 hints

If you get stuck, there are number of things to try.

And if you can only do part of a problem - turn that in.

The point of all this is to stretch your mind, not to get the right answers.

Here are a few specific useful tricks for this week's problems.

>>> "one two three".split()   # break a string into words
['one', 'two', 'three']

>>> [' '] * 200               # make a long empty list of spaces

>>> file.readlines()          # read in lines from a file

>>> chr(ord('a') + 2)         # two characters past 'a'

The accumulator pattern can be used to count things in a file.

Good luck! /courses /fall2020 /introcs /assignments /5
last modified Sat September 12 2020 11:15 am