Python Archive
While loop: “while” is a keyword. “while” is used to execute a block repeatedly until condition is valid. “while” takes only condition as expression. Syntax: Flow Chart: As condition always True, it repeats infinite times: …
for loop: “for” is a keyword. It is another looping control statement. “for” is used to execute a block of instructions repeatedly as long as the specified condition is valid. In python, for loop uses …
Nested Loops: Defining a loop inside another loop. Inner loop condition evaluates only when outer condition is valid. Execution terminate only when outer condition fails. Nested while loop codes: The following code snippets are used …
break: It is used to terminate the loop execution. It can be used inside the loop only It can terminate infinite loop also. We cannot use break to terminate a block. Block executes only once, …
continue: “continue” is a keyword. It is used to terminate a particular iteration in loop execution. It continues with the next iteration in the loop after terminating current iteration. Display 0 to 9 without 5: …
pass: “pass” is a keyword It is a branching statement. It is used to define a block or function or loop or class with empty body. We cannot define these things directly. pass keyword in …
Variable: Variable is an identity of memory location The main aim of application is “Data Processing”. Variables are used to store and process the data of a Program. Name Rules to define identifier: Python Variables/identifiers …
Local variables: Defining a variable inside the function. Local variables can be accessed only from the same function in which it has defined. We access the local variable directly. Arguments of a function: Variables used …
Global variables: Defining a variable outside to all the functions. We can access the variable directly. It is available throughout the application. We can define local & global variables with the same name. We access …
global: “global” is a keyword. It is used to define, access, modify & delete global variables from the function. global statement must be placed inside the function before the use of that variable. We can …