Iterations¶

Concepts¶

  • iterating = repeating = looping

  • the range and the enumerate functions

  • Value Traversal

  • Index Traversal

  • Conditional Iteration

Keywords¶

Examples¶

Notes¶

  • Iterations
    • The range function
    • The enumerate function
    • Indexed sequences
    • Sequence Traversal
    • Sequence Index Traversal

Slides¶

  • List operations slides

  • List methods slides

  • List traversal slides

  • List traversal 2 slides

References¶

  • Section 6 in *Notes by Prof. D. Ayala*.

  • How to Think Like a Computer Scientist: Learning with Python 2nd Edition.

Exercises¶

  • A 100m race
  • Apply prefix
  • Contest
  • Cuts
  • Five a day
  • Flat rate
  • List indexing
  • List mutability
  • Marks
  • Measures
  • Pensions
  • Positives and negatives
  • Remove the repeated elements of a list
  • SO2 levels
  • Salespeople
  • Shoe shop
  • Switch minimum and maximum
  • Traveler expenses
  • Trucks
  • WordCount

Logo

Programming Course

Table of Contents

  • Iterations
    • Concepts
    • Keywords
    • Examples
    • Notes
    • Slides
    • References
    • Exercises

Quick search

©2025, Prof. Lluís Vila, dept. CS, ETEIB, UPC. Publicat sota la llicència Reconeixement-CompartirIgual 3.0 No adaptada de Creative Commons. | Powered by Sphinx 5.3.0 & Alabaster 0.7.12 | Page source
This page uses Google Analytics to collect statistics. You can disable it by blocking the JavaScript coming from www.google-analytics.com.