0% found this document useful (0 votes)
43 views3 pages

Conditional

This document discusses different types of control statements in Python including conditional statements, iterative statements, and empty statements. It explains sequence, selection, and iteration as constructs that control the flow of a program. The document also briefly covers algorithms and flowcharts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views3 pages

Conditional

This document discusses different types of control statements in Python including conditional statements, iterative statements, and empty statements. It explains sequence, selection, and iteration as constructs that control the flow of a program. The document also briefly covers algorithms and flowcharts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Conditional and Iterative

Statements
Control Statements in Python are the statements which control or change the flow of execution of a
program.
There are number of control statements available in Python, that decides the flow of execution.
Types of statements in python
o Statements are the instructions given to the computer to perform any kind of action, be it data
movements, and be it making decisions or be it repeating actions.
o Empty statement
▪ A statement which does nothing is known as empty statement.
▪ In python empty statement is pass statement.
▪ A pass statement is useful in those places where the syntax of language requires the presence of
a statement but where the logic of the program does not.
o Simple statement
▪ Any single executable statement is a simple statement in Python.
o Compound statement
▪ A compound statement represents a group of statements executed as a unit. The compound
statements of Python are written in a specific pattern as shown below:
<compound statement header> (<Header>):
<indented body containing multiple simple and/or compound
statements>(<body>)
Statement flow control

www.programmingwithmaurya.com
© This Content is for private use only. Circulation via any medium is illegal and liable to strict actions.
o Sequence
▪ The sequence construct means the
statements are being executed
sequentially.
▪ Sequence refers to the normal flow
of control in a program and is the simplest
one.
▪ When the final statement of program is State
executed, the program is done.

o Selection
▪ The selection construct means the
execution of statements depending upon a
condition-test.
▪ If a condition evaluates to True, a course of
action is followed otherwise if False then
another course-of-action is followed.

o Iteration(looping)
▪ In programming, loops are a sequence of
instructions that does a specific set of
instructions or tasks based on some conditions
and continue the tasks until it reaches certain
conditions.
▪ It is seen that in programming, sometimes
we need to write a set of instructions
repeatedly - which is a tedious task, and the
processing also takes time.
▪ So, in programming, we use iteration
technique to repeat the same or similar type
of tasks based on the specified condition.
Algorithm
o An algorithm is a step-by-step procedure to solve a
given problem.
o Read and analyse the given problem
o Decide about basic sub-task need to solve a problem
o Order these subtask
o Algorithms are commonly written out with tools like pseudocode, flow chats or decision trees and tables.

www.programmingwithmaurya.com
© This Content is for private use only. Circulation via any medium is illegal and liable to strict actions.
Flowcharts
o A flowchart is a graphical representation of steps in algorithm to solve a given problem.

www.programmingwithmaurya.com
© This Content is for private use only. Circulation via any medium is illegal and liable to strict actions.

You might also like