Conditions are a way to control the flow of execution of the program, most often we apply conditions in the program to control the logic and achieve certain results. In Python we can achieve control by using the following statements:
- If statement
- Elif statement
- If-else statement
- Switch statement
- Pass Statement
- Break statement
- Continue statement
Examples:
If x < 5: print(x) break elif x < 10: print(x) continue else pass // Switch statement switch(x): case x < 5: print(x) break case x < 10: print(x) break default: break
Approved by experts