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.
- Create
fruitsover four fruit values and print a sentence per item; save, check mode, run. - Create
namelistover three names; save, verify permissions, execute. - Create a number-word loop over one to five; explain whether it performs numeric counting.
- Create the baseball-team loop as in the source prompt and identify its syntax elements.
- Create the command loop over
who,ls,pwd. Record outputs and explain environment effects. - Create a second simple loop with a list containing one duplicate, then another with reversed order. Predict and record output order/count.
- Remove one list item and explain why the body runs fewer times. Add one item and retest.
- 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?