0% found this document useful (0 votes)
5 views3 pages

Title:: Write A Python Program To Understand If, If Elif Else, For Loop, While Loop, Break and Continue Statements

The document is a Python lab report by Sumit Chaudhari, demonstrating various control flow statements in Python, including if, if-elif-else, for loops, while loops, break, and continue. Each section includes code examples and their expected outputs. The report is structured with clear headings and outputs for each programming concept.

Uploaded by

ninhokay0726
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Title:: Write A Python Program To Understand If, If Elif Else, For Loop, While Loop, Break and Continue Statements

The document is a Python lab report by Sumit Chaudhari, demonstrating various control flow statements in Python, including if, if-elif-else, for loops, while loops, break, and continue. Each section includes code examples and their expected outputs. The report is structured with clear headings and outputs for each programming concept.

Uploaded by

ninhokay0726
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Name Sumit chaudhari

Roll no :- 13 Date :- / / 2025 Sign :-


Branch :- Second Year B.Tech (IT)
Sub:- Python Lab
Exp. No:- 03
Remark :-

Title : Write a python program to understand if , if elif else , for loop , while
loop ,break and continue statements.
# Demonstrating if statement
x = 10 if x > 5:
print("x is greater than 5") Output:

#output

x is greater than 5

===========================================================

# Demonstrating if-elif-else num =


int(input("Enter a number:")) if
num > 0:
print("Positive number") elif
num < 0:
print("Negative number") else:
print("Zero") #Output:

Enter a number: 3
Positive number

===========================================================
# Demonstrating for loop
print("For loop example:")
for i in range(5):
print(i)

# Output: For

loop example:

0
1
2
3
4
===========================================================

# Demonstrating while loop


print("While loop example:")
y = 0 while y < 5: print(y)
y += 1
#Output: While

loop example:

0
1
2
3
4
===========================================================
=
# Demonstrating break
print("Break statement example:")
for i in range(10): if i == 5:

break

print(i)

Output: Break

statement example:

0
1
2
3
4

===========================================================
=
# Demonstrating continue
print("Continue statement example:")
for i in range(5): if i == 2:
continue print(i)

#Output:
Continue statement example:
0
1
3
4

===========================================================
=

You might also like