0% found this document useful (0 votes)
25 views

Lesson 12 - Iterative Control: Multi-Way Selection by Use of Elif Header

This document discusses iterative control and multi-way selection using if/elif statements. It provides an example of using elif to print different grade letters based on a student's grade, ranging from A to F. It then defines control structures and statements, and introduces iterative control as statements that repeatedly execute a set of instructions, like loops. It notes that commonly used iterative controls are while statements, and provides an example structure of a while loop that will repeatedly execute statements as long as a condition remains true.

Uploaded by

raasiboi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Lesson 12 - Iterative Control: Multi-Way Selection by Use of Elif Header

This document discusses iterative control and multi-way selection using if/elif statements. It provides an example of using elif to print different grade letters based on a student's grade, ranging from A to F. It then defines control structures and statements, and introduces iterative control as statements that repeatedly execute a set of instructions, like loops. It notes that commonly used iterative controls are while statements, and provides an example structure of a while loop that will repeatedly execute statements as long as a condition remains true.

Uploaded by

raasiboi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Lesson 12 Iterative Control

Multi-way selection by Use of elif Header


If grade >= 90;
Print(Grade of A)
Elif grade >= 80;
Print(Grade of B)
Elif grade >= 70;
Print(Grade of C)
Elif grade >= 60;
Print(Grade of D)
Else;
Print(Grade of F)

If else if

Control Structures
Control Statement
One that determines control flow of a set of instructions
Always Boolean (True or False)

How do we program this?


-

Average GPA for 3 students


Add 3 variables, add them all up and divide them by 3
For this classroom
Find out how many students re in the classroom, create variables for each
student, divide by that number
For Queens

Iterative Control

Iterative control statement


A control statement providing the repeated execution of a set of instructions

Iterative controls: AKA loops


Commonly referred to as Loops because of their repeated execution
Next: the while statement

How does a while statement work?


While condition:
Statement
Statement

Statement
Statements

While condition

You might also like