There three flow control’s are there those are
- Conditional Statement/Selection Statement
- Iterative Statement
- Transfer statement
Conditional Statement/Selection Statement: Conditional statement also know as selection statement. Conditional statement contain three flow control those are
- If Condition:
- An “if statement” is written by using the if keyword.
a = 10
if a == 10:
print("a is equal to 10 number")
Iterative Statement:
Some times we required to execute group of statement repeatedly then we need to go for iterative statement.
Loop: Group of statement’s executed repeatedly until condition satisfied.
There are two loop’s are there those are
- For Loop:
- syntax: for each-element in sequence:
- do something
- syntax: for each-element in sequence:
- While Loop:
- syntax: while condition:
- do something
- syntax: while condition:
Note: do while loop not there in python.
Transfer statement:
- Break: break statement terminates the loop.
- Continue Statement: continue statement is used to skip the rest of the code inside a loop for the current iteration only. Loop does not terminate but continues on with the next iteration.
- Pass Statement: pass statement is a null operation; nothing happens when it executes. pass is keyword in python.
- Del Statement: del is keyword in python. del keyword is used to delete objects. In Python everything is an object, so the del keyword can also be used to delete variables, lists, or parts of a list etc.