The document discusses Python control flow statements including if/elif/else statements, for loops, while loops, and break, continue, and pass keywords. If statements execute code based on a conditional test and can be combined with else blocks. Elif allows checking multiple expressions. For loops iterate over elements of a sequence a set number of times, while while loops continue executing until a condition is no longer true. Break exits the current loop, continue goes to the next iteration, and pass acts as a null operation.
The document discusses Python control flow statements including if/elif/else statements, for loops, while loops, and break, continue, and pass keywords. If statements execute code based on a conditional test and can be combined with else blocks. Elif allows checking multiple expressions. For loops iterate over elements of a sequence a set number of times, while while loops continue executing until a condition is no longer true. Break exits the current loop, continue goes to the next iteration, and pass acts as a null operation.
The document discusses Python control flow statements including if/elif/else statements, for loops, while loops, and break, continue, and pass keywords. If statements execute code based on a conditional test and can be combined with else blocks. Elif allows checking multiple expressions. For loops iterate over elements of a sequence a set number of times, while while loops continue executing until a condition is no longer true. Break exits the current loop, continue goes to the next iteration, and pass acts as a null operation.
statement An ELSE statement contains the block of code that executes, when conditional expression in IF statement resolves to FALSE ELSE is an optional statement to IF Syntax : if, else if test expression: statement_1 else: statement_2 Elif Statement AN ELIF statement allows us to check multiple expressions for TRUE value Similar to else, An ELIF statement is an optional statement There can be a number of ELIF statements which are following an IF statement Syntax : elif if test expression_1: statement_1 elif test expression_2: statement_2 elif test expression_3: statement_3 else: statement_4 For Loop For loop is used to iterate over elements of a sequence It is often used when we have a piece of code which we want to repeat "n" number of times Syntax for iterating_var in sequence: Body of for loop While Loop While loop will continue to execute a block of code while some condition remains true Syntax while some_condition: Body of while While Loop Syntax while some_condition: Do something else: Do something different break, continue , pass break : Breaks out current closest loop continue : goes to top of the closest enclosing loop pass : does nothing