Python continue Statement

Python continue statement is used to skip the execution of the current iteration of the loop. We can’t use continue statement outside the loop, it will throw an error as “SyntaxError: ‘continue’ outside loop“. We can use continue statement with for loop and while loops. If the continue statement is present in a nested loop, it skips the execution

Python continue Statement Read More »

Python break Statement

The break statement in Python is used to get out of the current loop. We can’t use break statement outside the loop, it will throw an error as “SyntaxError: ‘break’ outside loop“. We can use break statement with for loop and while loops. If the break statement is present in a nested loop, it terminates

Python break Statement Read More »

Python while Loop

Python while loop is used to repeat a block of code until the specified condition is False. The while loop is used when we don’t know the number of times the code block has to execute. We should take proper care in writing while loop condition if the condition never returns False, the while loop

Python while Loop Read More »

Python for Loop

Python for loop is used to iterate over an iterable. Any object that returns its elements one by one to be iterated over a for loop is called Iterable in Python. Some of the common examples of iterables are List, Tuple, and String. The for loop is the core building block of python programming. Implementing

Python for Loop Read More »

Python if else elif Statement

Python if-elif-else statement is used to write a conditional flow code. The statements are in the order of if…elif…else. The ‘elif’ is short for ‘else if’ statement. It’s shortened to reduce excessive indentation. The else and elif statements are optional. There can be multiple elif statements. We can have only one else block for an

Python if else elif Statement Read More »