Python – Flow Control

Loops in Python for Business Analyst

Loops in Python for Business Analyst Choosing the Right Loop Construct Python offers a variety of constructs to do loops. This article presents them and gives advice on their specific usage. Furthermore, we will also have a look at the performance of each looping construct in your Python code. It might be surprising for you. …

Learn Python By Example – while Statement

while Statement Import the random module import random Create a variable of the true number of deaths of an event deaths = 6 Create a variable that is denotes if the while loop should keep running running = True while running is True while running: /* Create a variable that randomly create a integer between …

Learn Python By Example – if and if else

if and if else Create a variable with the status of the conflict. 1 if the conflict is active 0 if the conflict is not active unknown if the status of the conflict is unknwon   conflict_active = 1 If the conflict is active print a statement if conflict_active == 1: print(‘The conflict is active.’) …

Python tutorials for Business Analyst – Python pass statement

(Python Tutorial – 014) Python pass statement In this article, you’ll learn about pass statement. It is used as a placeholder for future implementation of functions, loops, etc.   What is pass statement in Python? In Python programming, the pass statement is a null statement. The difference between a comment and a pass statement in Python is that while the interpreter …

Python tutorials for Business Analyst – Python break and continue

(Python Tutorial – 013) Python break and continue In this article, you will learn to use break and continue statements to alter the flow of a loop.   What is the use of break and continue in Python? In Python, break and continue statements can alter the flow of a normal loop. Loops iterate over a block of code …

Python tutorials for Business Analyst – Python while Loop

(Python Tutorial – 012) Python while Loop Loops are used in programming to repeat a specific block of code. In this article, you will learn to create a while loop in Python. What is while loop in Python? The while loop in Python is used to iterate over a block of code as long as …

Python tutorials for Business Analyst – Python for Loop

(Tutorial – 011) Python for Loop In this article, you’ll learn to iterate over a sequence of elements using the different variations of “for” loop. What is for loop in Python? The for loop in Python is used to iterate over a sequence (list, tuple, string) or other iterable objects. Iterating over a sequence is called traversal. …

Python tutorials for Business Analyst – Python if…else Statement

(Tutorial – 010) Python if…else Statement In this article, you will learn to create decisions in a Python program using different forms of if..else statement.   What is if…else statement in Python? Decision making is required when we want to execute a code only if a certain condition is satisfied. The if…elif…else statement is used in Python …