33% found this document useful (3 votes)
2K views2 pages

Ch8-Iterative Statements in Python-Lead Notes

The document contains notes on iterative statements in Python from a Grade 8 computer science class. It defines iterative statements as statements that repeat as long as a given condition is true, and provides for and while loops as examples. It explains that for and while loops are called entry-controlled loops because the condition is checked at the beginning of the loop. Additionally, it describes the use of membership operators like in and not in to control loop execution and check if a value exists in a sequence. The syntax of for and while loops in Python is also provided.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
33% found this document useful (3 votes)
2K views2 pages

Ch8-Iterative Statements in Python-Lead Notes

The document contains notes on iterative statements in Python from a Grade 8 computer science class. It defines iterative statements as statements that repeat as long as a given condition is true, and provides for and while loops as examples. It explains that for and while loops are called entry-controlled loops because the condition is checked at the beginning of the loop. Additionally, it describes the use of membership operators like in and not in to control loop execution and check if a value exists in a sequence. The syntax of for and while loops in Python is also provided.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

Grade VIII

COMPUTER SCIENCE
Lead notes
Unit No:8
Name of the chapter: Iterative Statements in Python
Date: 03.03.2022 No. of pages: 2
NOTE –
➢ Write the Lead notes in your Computer Science CW.
➢ Submission date- 05.03.2022

1. Answer the following questions:

a) What do you mean by Iterative statements? Give examples.


Ans: The statements that keep repeating themselves as long as a given condition is true are called Iterative
Statements or Repetitive Statements. As soon as the condition becomes false, the loop terminates. These are
also called Looping statements or simply Loops.
The two types of Iterative statements used in Python are for loop and while loop.

b) Why are for and while loops called entry-controlled loops?


Ans: The for and while loops called entry-controlled loops because the condition statement is checked in
the beginning of the loop.

c) What is the use of membership operators in Python?


Ans: Membership operators play an important role in controlling the working of a loop. There are two
membership operators, in and not in. Out of these, the in operator is used with loops. The in operator is used
to check if a given value exists in the sequence or not. It evaluates to true if it finds a value in the specified
sequence else it returns false.

d) Write the syntax of for and while loops.


Ans:
Syntax of for loop:
NPS.ITPL-2021/22/LN-CS
for <variable> in range (initial value, final value, step value):
Loop body (statements to be executed)

Syntax of while loop:


Initialization
while <Condition/ Test Expression>:
Loop body
Step value /updation

NPS.ITPL-2021/22/LN-CS

You might also like