Open in TheBrain

Practice Lab 10.11

Practice Lab 10.11 — List Variation and Loop Tracing

Name: Date:

Instructions

This is a complete Lab 10 worksheet with added list variations. Write all scripts in vi in a safe directory. Record predictions, output, and line-by-line explanations.

  1. Create fruits over four fruit values and print a sentence per item; save, check mode, run.
  2. Create namelist over three names; save, verify permissions, execute.
  3. Create a number-word loop over one to five; explain whether it performs numeric counting.
  4. Create the baseball-team loop as in the source prompt and identify its syntax elements.
  5. Create the command loop over who, ls, pwd. Record outputs and explain environment effects.
  6. Create a second simple loop with a list containing one duplicate, then another with reversed order. Predict and record output order/count.
  7. Remove one list item and explain why the body runs fewer times. Add one item and retest.
  8. Complete a keyword and invocation review: for, in, do, done; save, permission-check, execute.

Reflection: Which list variation affected repetition count versus only output order?