Category: Basic
-
Data Layout
COBOL layout is the description of use of each field and the values present in it. Following are the data description entries used in COBOL − Redefines Clause Redefines clause is used to define a storage with different data description. If one or more data items are not used simultaneously, then the same storage can…
-
Nested Loops
In Python, when you write one or more loops within a loop statement that is known as a nested loop. The main loop is considered as outer loop and loop(s) inside the outer loop are known as inner loops. The Python programming language allows the use of one loop inside another loop. A loop is a code block that executes…
-
pass Statement
Python pass Statement Python pass statement is used when a statement is required syntactically but you do not want any command or code to execute. It is a null which means nothing happens when it executes. This is also useful in places where piece of code will be added later, but a placeholder is required to ensure…
-
Continue Statement
Python continue Statement Python continue statement is used to skip the execution of the program block and returns the control to the beginning of the current loop to start the next iteration. When encountered, the loop starts next iteration without executing the remaining statements in the current iteration. The continue statement is just the opposite to that of break. It skips the…
-
break Statement
Python break Statement Python break statement is used to terminate the current loop and resumes execution at the next statement, just like the traditional break statement in C. The most common use for Python break statement is when some external condition is triggered requiring a sudden exit from a loop. The break statement can be used in both Python while and for loops. If you are…
-
While Loops
Python while Loop A while loop in Python programming language repeatedly executes a target statement as long as the specified boolean expression is true. This loop starts with while keyword followed by a boolean expression and colon symbol (:). Then, an indented block of statements starts. Here, statement(s) may be a single statement or a block of statements with uniform indent.…
-
for else Loops
Python – For Else Loop Python supports an optional else block to be associated with a for loop. If a else block is used with a for loop, it is executed only when the for loop terminates normally. The for loop terminates normally when it completes all its iterations without encountering a break statement, which allows us to exit the loop when…
-
For Loops
The for loop in Python provides the ability to loop over the items of any sequence, such as a list, tuple or a string. It performs the same action on each item of the sequence. This loop starts with the for keyword, followed by a variable that represents the current item in the sequence. The in keyword links the variable to…
-
Loops
Python Loops Python loops allow us to execute a statement or group of statements multiple times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on. There may be a situation when you need to execute a block of code several number of…
-
MatchCase Statement
Python match-case Statement A Python match-case statement takes an expression and compares its value to successive patterns given as one or more case blocks. Only the first pattern that matches gets executed. It is also possible to extract components (sequence elements or object attributes) from the value into variables. With the release of Python 3.10, a pattern matching…