Arrays and loops recitation
Purpose:
The main purpose is to learn about for loops and arrays. Arrays store
lists of data and for loops are used to traverse them. We start by
reviewing for loops from last week. Last week we only got as far as the
while loops.
We review two kinds of arrays. The first is a regular array defined
with square brackets []. The second kind of array is a string variable.
A string is an array of characters.
Again, these exercises are based on explanations in the lecture slides.
Refer to the slides for details.
Parts
Answers
- Part 1
- See last week
- Part 2
- Display array
- Compute average
- Part 3
- Display string
- Count A
- Count B