0% found this document useful (0 votes)
14 views17 pages

Answerkey GR 8 Python Programming Lab Manual

The document is a laboratory manual for a Python programming course covering loops, including for and while loops, and control flow statements like break and continue. It outlines learning objectives and outcomes for students, emphasizing their ability to write and implement various loop structures in Python. Additionally, it includes a list of example programs to practice these concepts.

Uploaded by

shiza.26974.s
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)
14 views17 pages

Answerkey GR 8 Python Programming Lab Manual

The document is a laboratory manual for a Python programming course covering loops, including for and while loops, and control flow statements like break and continue. It outlines learning objectives and outcomes for students, emphasizing their ability to write and implement various loop structures in Python. Additionally, it includes a list of example programs to practice these concepts.

Uploaded by

shiza.26974.s
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

PYTHON PROGRAMMING

LABORATORY MANUAL-2
COMPUTER SCIENCE
[AY 2025-2026]

Topics Covered:

1. Loops in Python (for loop)


2. Loops in Python (While loop)
3. for loop with range()
4. Break and continue statement with for loop
Learning Objectives:

➢ Understand the syntax and structure of a 'for loop' and ‘while loop’ in Python.
➢ Write Python code that uses 'for loops' to iterate over different types of sequences.
➢ Implement 'for loops' to perform repeated actions, such as processing items in a
list or iterating over characters in a string.
➢ Implement while loops to perform repeated actions based on a condition, such as
counting, input validation, or looping until a specific criterion is met.
➢ Combine 'for loops' with other control structures (like if statements) to solve more
complex problems.
➢ Use break and continue statements within for loops to control loop execution
flow, such as exiting a loop early or skipping specific iterations based on
conditions.

Learning Outcomes:

➢ Students will be able to explain the components and operation of a 'for loop' in
Python, including the use of the for keyword, loop variables, and the ‘in’ keyword
for iterating over sequences.
➢ Students will be able to use range() function with ‘for loop’ to generate a number
sequence.
➢ Students will be able to create Python scripts that utilize 'for loops' to perform
repeated tasks, including processing elements in a list and iterating over each
character in a string, ensuring correct and efficient code execution.
➢ Students will be able to integrate 'for loops' with other control structures, such as
if statements, to develop solutions for more complex programming challenges,
demonstrating a comprehensive understanding of control flow in Python.
➢ Students will be able to write and apply while loops in Python to perform repeated
actions based on conditional logic, such as counting, validating input, or looping
until a specific condition is satisfied.
➢ Students will be able to apply break and continue statements within for loops in
Python to manage control flow, such as terminating loops early or skipping
specific iterations based on given conditions.
INDEX
Prg.
List of Programs Date Sign
No.
Python program to print every letter of your name using for
1
loop.
Python program mask every letter of the password "star123"
2
with * using for loop
Python program to display all the 7 Emirates of the UAE using
3
for loop.
Python program to display a welcome message for each
4
Emirate of the UAE using for loop.
Python program to print the below pattern using for loop.

6 Python program to print first 10 whole numbers.

Python program to print the multiplication table (using for


7
loop)
Python program to count down from 10 to 0 and display “Blast
8
Off!” message
Python program to break a loop when the number equals 7
9 using break statement. Range(0,12)

Python program to skip the iteration when number equals to 8


10
using continue statement. Range(0,12)
Python program to find the sum of first ‘n’ numbers using
11
while loop.
Program No: 1
Input:

Output
Program No: 1a
Input:

Output:
Program No: 2
Input:

Output:
Program No: 3
Input:

OUTPUT:
Program No: 4
Input:

Output:
Program No: 5
Input:

Output:
Program No: 6
Input:

Output:
Program No: 7
Input:

Output:
Program No: 8
Input:

Output:
Program No: 9
Input:

Output:
Program No: 10
Input:

Output:
Program No: 11
Input:

Output:

SAMPLE HTML CODE:

You might also like