Class:-8
Lesson:- 8 Iterative Statements in Python.
Page No.-: 132 Exercise
A.
1. a)
2. a)
3. b)
4. c)
5. c)
B. Fill in the blanks
1. Repetition is another name of iteration .
2. for and while are the two types of looping statements in python.
3. A for loop is used for iterating over a sequence bracket.
4. List is sequence , denoted by a square bracket.
5. Infinite loops will only stop when there is a user-defined break applied to it.
C. Write True or False
1. False 2. True 3. True 4. False 5. False
Hard Words :- (Find hard words this is your homework.) Leave one page for hard words.
This chapter has not any short answer start with book's question.
( Do in fair notebook with clean writing )
Question and Answer
Q.1 Differentiate between a list and a tuple.
Ans:- List :- List is a ordered but interchangeable( we can change) items. We makes list in a square bracket . Like :- a=[ "Rahul", "Avni", Tanvi", "Navya" ].
Tuple :- It is a list of ordered items which cannot be interchanged( we can't change) . Tuple is denotes by a round bracket. Like:- ("Ramesh", "Dinesh", "Geeta", "Reeta")
Q.2 Different between 'for loop' and 'while loop'.
Ans:- for loop:- a for loop is used to iterating over a sequence . A sequence could be a list , a tuple, a set or string.
while loop:- The while loop repeatedly executes a set of commands for as long as the condition given along with it is true.
Q.3 What are infinite loops?
Ans:- An Infinite loops is a loop that continues forever and never ends. The only way to come out of such loops is to apply a condition -specific break.
Q.4 What is the use of range ( ) function in for loop ?
Ans:- The range ( ) function returns a sequence of numbers , stating from 0 ( by default) , and increment by 1 (by default) , and ends at a specified number.
Example:- for i in range (8) :
print(i)
Output:-
1
2
3
4
5
6
7
Q.5 What is the use of else in for loop ?
Ans:- The else keyword in a for loop specifies a block of code to be executed when the loop is finished.
Syntax :- for < variable> in range ( ):
# body_of_loop
else:
# statement1
END
If you have any type of question or doubt . Write in comment section i will reply soon.
Sir is chapter ke short question answer??
ReplyDeleteNo short answer in this chapter .... ( Isme Chapter koi short question nhi hai )
ReplyDelete