Posts

Showing posts from July, 2023

Flow of Control

Image
Flow of control refers to the specification of the order in which the individual statements, instructions or function calls of a program are executed or evaluated. in order to control the flow of program, we have -  1. Conditional programming  2. Looping   

Conditional Statements

In python If else statement is also known as conditional statements to check if the condition is true or false. And it is also known as a decision making statement. 1.  If statement -  It is the simple decision making statement. In this statement when we execute some lines of code then the block of statement will be executed or not i. e If the condition is true then the block of statement will be executed otherwise not.  2.  If…else statement -  In if statement if condition is true then it will execute a block of statement and if the condition is false then it won’t. but in this statement there are two blocks . In this statement if the condition is false then execute the else condition.  3.  Nested if statement -  Nested if in python is placing an if statement inside another if statement. Nested if statement helpful if you want to check another condition inside a condition. Python provides this feature to check multiple conditions in a given progr...

Looping Statements

The programming languages provide various kinds of loops that are able to repeat some particular code numerous numbers of times. The loops in python are -  1. For Loop -   The for loop is used in the case where a programmer needs to execute a part of the code until the given condition is satisfied. The for loop is also called a pre-tested loop. It is best to use for loop if the number of iterations is known in advance. 2.  While Loop -   The while loop is to be used in situations where the number of iterations is unknown at first. The block of statements is executed in the while loop until the condition specified in the while loop is satisfied. It is also called a pre-tested loop.  In Python, the while loop executes the statement or group of statements repeatedly while the given condition is True. And when the condition becomes false, the loop ends and moves to the next statement after the loop. 3. Nested Looping statements -   The Python programming langua...

Strengths and Weaknesses of Python

 Strengths  Easy to read, learn and code.  Dynamic Typing Free, Open Source Platform-independent Wide Range of Applications Extensive Third-Party Libraries Weaknesses  Simple Nature Slow Speed and Memory Inefficient Poor Database Access Weak Mobile Computation Runtime Errors due to dynamic typing