Quiz 4: For Loops and Sequences
Learning Goals
Students should be able to:
- Write expressions that create and manipulate sequences (strings, lists, ranges).
- Use indexing to access elements in a sequence from the front or the back.
- Predict the type of expression results which use operations on sequences such as
in,not in,+,*, slicing,len,min,max. - Know about and use a variety of operations on sequences, including
in,not in,+,*, slicing,len,min,max. - Use indexing to access elements in a sequence from the front or the back, as well as in nested structures.
- Create iteration tables to understand and define loops.
- Write the syntax of a
forloop. - Understand the difference between a
forvalue loop and aforindex loop. - (111A students only): understand the use of
breakandcontinuestatements in a loop. (For Quiz 4, thefor/elsestatement will not be tested, but students should understand this for the future.) - Read and write loops that use accumulation variables to calculate results.
- Read and write
forvalue loops that use tracking variables to summarize information from previous values. - Use print statements to illustrate the operation of a loop.
- Use
forandwhileloops to translate English descriptions of iteration into Python/ - Explain the rules governing a
forloop's execution in English. - Design algorithms to solve simple problems using iteration /
- Predict the effects of loops.
Study Guide
Blank (fill in your solutions)
Solutions
After your quiz is graded by instructors, you will get an email from Gradescope. Solutions for individual quiz questions are provided in the Gradescope rubric.