Computer Science 15-112, Fall 2011
Class Notes: Practice (through week 4)
- Previous practice handout
See this handout for
previous practice problems, including many problems that use strings in
interesting ways.
- String practice problems (with solutions and
video tutorials)
Check out these practice problems from
S11 hw2 (strings)
and S11 hw3 (strings
and loops). For best results, try to solve them first
(starting from the provided starter code), then check out the provided
sample solutions and video tutorials.
- Mastermind
Also check out this
Mastermind practice problem from S11 recitation 3. Try to
implement the missing functions before consulting the sample solutions
provided.
- Rewrite string methods
(without importing string)
One of the easiest ways to practice writing functions with strings
is to rewrite the string methods without importing string (so
only using built-in functions, like len, and operators like + and
slicing). For example, try these:
- capitalize
- center
- count
- endswith
- expandtabs
- find
- isalnum, isalpha, isdigit, islower, isspace,
istitle, isupper
- replace
- startswith
- swapcase
- title
- upper
- zfill
carpe diem -
carpe diem - carpe diem - carpe diem
- carpe diem - carpe diem -
carpe diem - carpe diem - carpe
diem