Break, Continue, & Pass Statement in Python

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Uses for pass

when drafting structure of code......

when do we use break, continue, or pass statements

to control the flow of loops

Continue Statement

continue is used to skip the rest of the current iteration and move directly to the next iteration of the loop

Pass

Acts as a placeholder and does nothing- allows you to maintain the structure of your code without having any operational statements

Use cases

When you want to stop the loop as soon as a specific condition is met

break, continue, and/or pass

control flow statements

break

used to exit out of the enclosing loop (either for or while loop)

Continue Uses

when you want to avoid executing certain parts of the loop for specific conditions, but not the whole loop


Ensembles d'études connexes

Starting Out with Python Chapter 7

View Set

Peds Test 1 (Ch. 1, 3, 4, 5, 10, 12, 13, 15, 17, 19, 20, 21, 22, & 23)

View Set

The Rational Roots Theorem Assignment

View Set

Career Exam One - Ability and Aptitude Assessment in Career Counseling

View Set

Computer Programming Chapter 4 Review

View Set