0% found this document useful (0 votes)
2 views2 pages

Assignment 2 Python(1)

This document outlines an assignment for the Python Programming course at ABES Engineering College for the 3rd semester of the 2025-26 session. It includes various programming tasks such as using loops, conditional statements, and generating patterns, alongside questions about Python concepts like the elif statement, continue, and pass statements. The assignment is to be submitted between November 4 and November 6, 2025.
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)
2 views2 pages

Assignment 2 Python(1)

This document outlines an assignment for the Python Programming course at ABES Engineering College for the 3rd semester of the 2025-26 session. It includes various programming tasks such as using loops, conditional statements, and generating patterns, alongside questions about Python concepts like the elif statement, continue, and pass statements. The assignment is to be submitted between November 4 and November 6, 2025.
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

ABES Engineering College, Ghaziabad

Department of Computer Science Engineering

Session: 2025-26 Semester:3rd Branch/Section: CSE/All


Course Code: BCC 302 Course Name: Python Programming

Assignment 2

Date of Assignment/Test: 04-Nov-2025 Date of submission: 06-Nov-2025


[Link] Description CO BL
a) What is the purpose of the elif statement in Python? How does it differ
1 from ifand else, and why is it important for handling multiple conditions?
CO2 K2
b) Discuss the basic structure of a for loop and for-else in Python. How do
youiterate over a sequence or collection using a for loop?
Develop a Python program that uses a while loop to simulate a basic guessing
2 CO2 K3
game. The program should generate a random number, and the user should
guessit. The game should provide feedback on whether the guess is too high or
too lowuntil the correct number is guessed.
Implement a program that prints the following pattern:
3 a) b)
CO2 K3

a)Create a program that generates and prints the first N prime numbers, where
N is input by the user.
4 CO2 K3
b) Develop a program that takes a string input from the user and counts the
numberof vowels (a, e, i, o, u) in the string using a for loop.
a) Explain how the continue statement works in a loop. Provide an example of
5 how you might use continue to skip certain iterations.
CO2 K1
b) Describe the role of the pass statement in Python loops. In what situations
wouldyou use it, and how does it affect program flow?
a) a) Create a Python program that checks if a given year is a leap year or not. Use
6 CO2 K3
conditional statements to determine the leap year criteria.
b) b) Write a Python program that asks the user to enter a series of numbers. Use a
while loop to continue prompting for input until the user enters the number 42.
When 42 is entered, terminate the loop using the break statement.
a) Write a Python program that calculates the sum of all even numbers from 1 to
7 100using a for loop. CO2 K3
b) Write a Python program to find the nth Fibonacci number
a) Create a program that takes a list of numbers as input and calculates their
8 CO2 K3
product using for loop.
b) Create a program that prints all even numbers between 1 and 20 using a for
loop,but skips the number 10 using the continue statement.
a) Write a Python program that repeatedly asks the user for a number until they
9 enter 0. Afterward, calculate and print the sum of all entered numbers using a while CO2 K3
loop.
b) Implement a program that checks whether a given list contains a specific
value. Ifthe value is found, print a message and exit the loop early using the
else clause.

a) Write a Python program to print a pattern of asterisks in the shape of a right-


10 angled triangle. Allow the user to input the height of the triangle. CO2 K3
b) Create a program that prints a pattern of numbers in the form of a Pascal's
triangle. Allow the user to input the number of rows for the triangle.

You might also like