Flow control and program structure definitions

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/9

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 12:40 PM on 4/16/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

10 Terms

1
New cards

Conditional

A conditional is a statement that runs different code depending on whether a condition is true or false. If, elif, and else are all used within conditionals to execute different blocks of code depending on whether conditions are true or false.

2
New cards

If statement

An if statement is a control structure that executes a block of code only if a condition is true.

3
New cards

Elif

Elif is used in a conditional to check another condition if the previous one was false.

4
New cards

Else

Else defines the block of code that runs if previous conditions in a conditional are false. Often, an else branch is used to raise an error for an invalid mode.

5
New cards

Loop

A loop is a control structure that repeats code multiple times. Loops are useful when you want to go through all items in a list, all characters in a string, values in a dictionary, or repeat something several times.

6
New cards

For loop

A for loop repeats once for each item in a an iterable object. For example, if you had the list numbers = [1, 2, 3] and then your code was

for number in numbers:

print (number)

you would get

1

2

3

7
New cards

While loop

A while loop keeps repeating as long as a condition is true. For example:

count = 0

while count < 3:
    print(count)
    count += 1

The count starts as 0, the loop runs because 0 < 3, prints 0, then increases to 1. Prints 1 then increases to 2. Prints 2 then increases to 3. Stops because 3 < 3 is false.

Output

0
1
2

8
New cards

Nested conditional

A nested conditional is a conditional statement placed inside another conditional statement.

9
New cards

Branch

A branch is one of the possible paths a program can take depending on a condition.

10
New cards