JCL

FEUP/DEI & INESC TEC

User Tools

Site Tools


teach:fpro:lectures:04

LE04: 22/10/2020

Master in Informatics and Computing Engineering
Programming Fundamentals
Instance: 2020/2021


Lecture #4 :: 22/10/2020

Goals

By the end of this class, the student should be able to:

  • Describe how to do iterations using while statements
  • Describe middle-test and post-test loops using the break and continue statements
  • Choose between for and while loops
  • Use nested loops for nested data (for example list of pairs)

Content

  • 3.3 Iteration
    • 3.3.1 Assignment
    • 3.3.2 Updating variables
    • 3.3.3 The for loop revisited
    • 3.3.4 The while statement
    • 3.3.5 The Collatz 3n + 1 sequence
    • 3.3.7 Counting digits
    • 3.3.9 Tables
    • 3.3.10 Two-dimensional tables
    • 3.3.11 The break statement
    • 3.3.12 Other flavours of loops
    • 3.3.13 An example
    • 3.3.14 The continue statement
    • 3.3.15 Paired Data
    • 3.3.16 Nested Loops for Nested Data
    • 3.3.17 Newton’s method for finding square roots
    • 3.3.18 Algorithms

Bibliography

  • Peter Wentworth, Jeffrey Elkner, Allen B. Downey, and Chris Meyers, How to Think Like a Computer Scientist — Learning with Python 3, Release 3rd Edition, 2020 [PDF] (Section 3.3)

Materials

Summary

  • Iteration using while statements. The break statement. The continue statement. Nested Loops for Nested Data.

FPRO, 2020/21

« Previous | Index | Next »

teach/fpro/lectures/04.txt · Last modified: 03/01/2021 17:39 by Correia Lopes