0% found this document useful (0 votes)
6 views

While_loop_Notes

Chapter 5 discusses the Python While Loop, which repeatedly executes a block of statements until a specified condition is false. It provides the syntax for the while loop and includes examples demonstrating its use, such as printing 'Hello Geek' three times and generating a multiplication table for the number 2. The chapter emphasizes the importance of the loop condition in controlling the execution flow.

Uploaded by

vidhu.bhis
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)
6 views

While_loop_Notes

Chapter 5 discusses the Python While Loop, which repeatedly executes a block of statements until a specified condition is false. It provides the syntax for the while loop and includes examples demonstrating its use, such as printing 'Hello Geek' three times and generating a multiplication table for the number 2. The chapter emphasizes the importance of the loop condition in controlling the execution flow.

Uploaded by

vidhu.bhis
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
You are on page 1/ 1

Chapter 5 Python

Python While Loop: is used to execute a block of statements repeatedly until a given condition
is satisfied. When the condition becomes false, the line immediately after the loop in the
program is executed.

Syntax of while loop in Python

while expression:
statement(s)
Flowchart of Python While Loop

Example1: In this example, the condition for while will be True as long as the counter variable
(count) is less than 3.

count = 0
while (count < 3):
count = count + 1
print("Hello Geek")
Output
Hello Geek
Hello Geek
Hello Geek

Example2: Printing the table of 2

num=2
i=1
while i <=10:
print(num,'x',i,'=',num*i)
i=i+1

You might also like