Control Structures in Python#
According to Busbee and Braunschweig’s “Structured Programming” Programming Fundamentals, “One of the most important concepts of programming is the ability to control a program so that different lines of code are executed or that some lines of code are executed many times. The mechanisms that allow us to control the flow of execution are called control structures. Flowcharting is a method of documenting (charting) the flow (or paths) that a program would execute. There are three main categories of control structures:”
Sequence [executes in given sequence]
Selection [selects between two or more flows using condition or question]
Iteration [repeats same piece of code multiple times]
This chapter provides an introduction to control structures in the Python programming langauge. Topics covered include:
Control flow and control structures
Event-controlled and count-controlled loops
Looping structures in Python (
forandwhile)
Acknowledgements
PLACEHOLDER
Acknowledgements#
When building this chapter, the author consulted materials developed by:
Dr. Peter Bui for the CSE 10101 “Elements of Computing I” course.
Dr. Janet Davis for the the CSC 105 “The Digital Age” course.
Dr. Corey Pennycuff for the CSE 10101 Elements of Computing (Fall 2019).
Dr. Lindsay K. Mattock for the the SLIS 5020 Computing Foundations course.
Definitions and explanations in this lab are adapted from Kenneth Leroy Busbee and Dave Braunschweig, Programming Fundamentals: A Modular Structured Approach, 2nd Edition (Rebus Press, 2018)
Application#
Your answers to this chapter’s application questions should be added to the notebook template.
Google Colab link (ND users only)
Submit the Colab link on Canvas for the assignment submission.