Python Programming – Flowcharts and Algorithms Introduction

You can learn about Flowcharts and Algorithms in Python Programs with Outputs helped you to understand the language better.

Python Programming – Flowcharts and Algorithms Introduction

Introduction

A flowchart is a graphical representation of an algorithm. It shows different subtasks with different symbols. A few symbols are needed to indicate the necessary operations in the flowchart. These symbols have been standardized by the American National Standards Institute (ANSI). These symbols are shown in Figure 2.1, and their functions are dis¬cussed below.

Terminal

The terminal symbol is used to indicate the starting (BEGIN) and stopping (END) in the logic flow of a program. It is the first and also the last symbol in the program logic.

Input/Output

Input/output symbol is used to indicate input/output operations in the program. If there is a program instruction to input data from any type of input device, then that step will be indicated in the flowchart with the input/output symbol. Similarly, all output instructions are indicated in the flowchart with the input/output symbol.

Processing

The processing symbol is used to represent arithmetic and data movement instructions in a flowchart. Thus, all arithmetic processes such as addition, subtraction, multiplication, and division are shown by the processing symbols. The logical process of moving data from one location of the main memory to another is also denoted by this symbol.

  • In the flowchart, the trapezoid symbol represents a manual operation.

Flow lines

Flow lines with arrowheads indicate the exact sequence in which the instructions are to be executed. This indication is also called the flow of instructions. Normally, the flow of instructions in a flowchart is from top-to-bottom and left-to-right. Arrowheads are generally required when the normal top-to-bottom flow is not to be followed. However, as a good practice and in order to avoid any confusion, flow lines are drawn with an arrowhead at the point of entry to a symbol.

  • Note that in a flowchart, the flow lines should not cross each other and that such intersections should be avoided whenever possible.

Decision

In a flowchart, a decision symbol is used to indicate a point at which a decision has to be made and to jump to one of the alternatives. Figure 2.2 shows three different ways in which the decision symbol can be used. It may be noted that the criterion for making the decision should clearly be indicated within the decision box. Moreover, the condition upon which each of the possible exit paths will be followed should also be identified. During execution, the correct path is followed based on the decision.

Connector

If the flowchart becomes too long or the flow lines start crisscrossing at many places, then it causes confusion and reduces the understandability of the flowchart. Moreover, there may be instances when the flowchart becomes too long to fit on a single page. Whenever the flowchart becomes complex enough, and the number and direction of flow lines are confusing or spread over more than one page, it is recommended to utilize the connector symbol as a

Python Programming – Introduction to Programming chapter 2 img 1

Python Programming – Introduction to Programming chapter 2 img 2

substitute for flow lines. This symbol represents an entry form, or an exit to, another part of the flowchart.

  • A connector symbol is represented by a circle, and a letter or digit is placed within the circle to indicate the link.

A pair of identically labeled connector symbols are commonly used to indicate a continued flow when the use of a line is confusing. So, two connectors with identical labels serve the same function as a long flow line. It may be noted that connectors do not represent any operation, and their use in a flowchart is only for the sake of convenience and clarity.

  • A letter or digit placed within the circle is used to indicate the link in the flowchart.

 

Leave a Reply

Your email address will not be published. Required fields are marked *