PyCodePro

Previously LP16 - A website that teaches Python programming language through interactive tutorials, practice exercises, and real-world projects.

CONDITIONAL AND ITERATIVE STATEMENT

CONDITIONAL AND ITERATIVE STATEMENTS


In python , this is very important topic and this is very big topic we complete this topic in parts .
From here the statements of python starts –

Now In this Topic We discuss about –

1 – Types of statement
2 – statement flow control
3 – program logic development tools
4 – The if statement of python
5 – Repetition of tasks – A Necessity
6 – The Range Function
7 – Iteration / looping statement

Types Of Statements In Python

Statement – Statement are the instructions given to the computer to perform the any kind of action.

In python there are three types of statement –

1 – Empty Statement
2 – Simple statement ( single statement )
3 – Compound Statement

Now Discuss More About These Statements –

1 – Empty Statement


It is the easiest statement

The empty statement does nothing , i.e., in  short term it is a pass statement
Whenever the empty ( pass ) statement is used python do nothing and moves
to the next statement.

A pass statement is used where the syntax of the language just requires the presence of statement but where the logic of the program
Does not.

Or

Pass statement is just requires the presence of
The statement and there will no logic in the program .

2 – Simple Statement

Any single executable statement is a simple statement in python –

For example –

r= input ( “Enter your roll no ” )

another example –

print ( r )

in simplest language , the simple statement are the single line statements

Conventionally – python uses four spaces to move to next level of indentation. 


3 – Compound Statement


A compound statement represents the group of statements executed as a unit . the compound statement of python are written in a specific pattern .

< compound statement header > :

The compound statement has –

A header line – which starts with a keyword and end with a colon .


A body – consisting of one or more python statements , each  conventionally inside the header line . All the statements in the body are at the same level of indentation .



We will learn about some other statements in this topic

\The next blog is on the – STATEMENT FLOW CONTROL

Stay tuned with us keep visiting our blog  


CONDITIONAL AND ITERATIVE STATEMENT CONDITIONAL AND ITERATIVE STATEMENT Reviewed by Learn Python on November 14, 2019 Rating: 5

No comments:

Powered by Blogger.