
Types of Statements in Python | CBSE Class 11| Computer Science
Dear Class 11th STUDENTS, ! Welcome to this tutorial of Types of Statements in Python from your CBSE class 11 of Computer Science Syllabus .
In this tutorial, we shall be learning our chapter-8: Types of Statements in Python from Unit 2: Programming and Computational Thinking (PCT-1) as CBSE BOARD suggested to learn about computer system and its organisation to complete this section.
Unit 2: Programming and Computational Thinking (PCT-1)
Chapter 6 : Types of Statements in Python:
- Simple statements/single
- Empty statements
- Compound statements
I advice you to check the latest syllabus given by CBSE Board at its Official website: www.cbseacademic.nic.in
Also, in this tutorial we will covers all necessary topics/concepts required to complete your exams preparations in CBSE classes 11th.
NOTE:
- We are also giving some important Questions & Answers for better understanding as well as preparation for your examinations.
- You may also download PDF file of this tutorial from our SHOP for free.
- For your ease and more understanding, we are also giving the video explanation class of each and every topic individually, so that you may clear your topics and get success in your examinations.
Introduction
Typically, when we run programs in python then python interpreter excludes its statement from belonging end to end / Line by line, but not many programs execute all statements in strict order as from beginning to end . A complex program can choose its execution sequence alternatively i.e., according to the need of the required output and to perform their manipulation magics, python program require some tools for performing repetitive actions and for making decisions and of course , python also provide such mechanism through STATEMENTS, such statement are called program control statements.
In this tutorial, we are going to learn about different kinds of control statements that python provides for statement and Iterative decision making through python programs.
Types of statements in python
As we discussed above, python provides different types of statements that can be used to perform the following actions through program.
- Data movements
- Decision making
- Repeating actions
“Hence statements are the smallest executable unit within a python program or statements are the instructions given to the computer to perform any kind of actions”
These python statement can belong one of the following three types.
- Simple statements/single
- Empty statements
- Compound statements
Let’s discuss these one by one.
Empty statements
A statement which does nothing is always an empty statement. It means an empty statement is a simplest statement in python, it is simply identified by the following
Pass
Whenever python executes a pass statement python does nothing and moves to the next statement in the flow of control . A pass statement is useful in those instances where the syntax of python requires a statement and the logic of the program does not require anything to do.
example program |
Simple statement
Any single statement that can be execute in python is called simple statement.
when a single statement written in a single line executes and perform some action within the python program, it is called as simple statement,
For example
Name=int (input (“your name”))
Print(name)
Compound statements
when we write more than one statement in multiple lines to be executed in python. This group of statement is called compound statement. This group of statements can perform repeating or iterative action according to logical requirements The compound statement in python are written in a specific pattern as shown below.
<compound statement header>:
<intended body containing multiple/single/compound statement>
That means; a compound statement has
- A header title with begins with a keyword and ends with a colon (:)
- A body containing or more python statements and each intended inside the header line, Also all statements in the body are at the same level of indentation.