0% found this document useful (0 votes)
3 views15 pages

Python Loops: For & While Syntax Guide

Module 4 covers the concept of loops in Python, focusing on the syntax and usage of 'for' and 'while' loops. It includes practical exercises to reinforce learning, such as printing names, numbers, and implementing infinite loops. Additionally, it explains key concepts like the 'break' and 'pass' statements, as well as nested loops.

Uploaded by

SUMY VINOD
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)
3 views15 pages

Python Loops: For & While Syntax Guide

Module 4 covers the concept of loops in Python, focusing on the syntax and usage of 'for' and 'while' loops. It includes practical exercises to reinforce learning, such as printing names, numbers, and implementing infinite loops. Additionally, it explains key concepts like the 'break' and 'pass' statements, as well as nested loops.

Uploaded by

SUMY VINOD
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

MODULE 4

LOOPS IN
PYTHON
MLO
IWBAT

● UNDERSTAND THE CONCEPT OF LOOPS


● UNDERSTAND THE SYNTAX OF for and while
loops
● WRITE PROGRAMS USING for and while loops
Keywords

Loops-repeat
for
while
Practicals :-

Write a program to print your name 10 times


1.
Practicals :-

2. Write a program to print numbers 1-100


Practicals:-

3. Write a program to print all odd numbers


between 1-100
Write a program to print numbers 1 to
10(using while loop

i=1
while i<=10:
print (i,end=” ”)
i=i+1
Write a program to print numbers 1 to 10 in
the reverse order(using while loop

i=10
while i>=1:
print (i)
i=i-1
True or False:-PAGE 50:

1. true
2. false
3. true
4. false
5. false
FILL IN THE BLANKS:-PAGE 50:

1. ---
2. while
3. for
4. break
5. continue
Answer the following:-

1. What is break statement in python?


break statement is used to exit the loop in python.
2. Write an infinite loop using while statement
i=1
while<=10:
print(i)
Answer the following:-

3. What is pass statement in python?


pass statement is used to fill the syntactical
requirement that code blocks(if, def,class etc) cannot be
empty.
4. What is nested loop?
Nested loop refers to a loop statement inside another loop
statement.
Answer the following:-

1. Pg 50-quick recall -1
2. For loop and while loop
3. Pg 50 quick recall 3
4. Pg 43 loop control statements
Answer the following:-

You might also like