0% found this document useful (0 votes)
4 views1 page

Python - Unit 2 Assignment

This document is an assignment for a B.Tech. course in Computer Science and Engineering focused on Programming with Python. It includes questions on string handling, control flow statements, and programming tasks such as checking for palindromes and printing specific patterns. The assignment is divided into three sections with varying marks allocated to each question.
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)
4 views1 page

Python - Unit 2 Assignment

This document is an assignment for a B.Tech. course in Computer Science and Engineering focused on Programming with Python. It includes questions on string handling, control flow statements, and programming tasks such as checking for palindromes and printing specific patterns. The assignment is divided into three sections with varying marks allocated to each question.
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

[Link].

(Computer Science and Engineering)


Semester-IV
Subject: Programming with Python (BCO 081B)
Marks : 64

Assignment (Unit-2)
Course Outcome (CO2): Express proficiency in handling of strings and control flow statements

SECTION A (5*2=10 Marks)

1. Explain the use of else in loops?


2. What is the pass statement in Python?
3. What is slice operation? Explain with an example
4. Explain the concept of range function in python.
5. Which conditional operators are supported in python?
SECTION B (3*7=21 Marks)
1. What is the difference between break and continue statement in loop?
2. Write a Python program to access the last character of the string (a) with and (b) without
the help of len() function.
3. Explain the various methods to test if the entered string contain digits or alphabets or
alphanumeric values.

SECTION C (3*11=33 Marks)


1. A. Demonstrate the different built-in operations used with strings using examples.
B. WAP to check whether a string is palindrome or not.
2. WAP to print following pattern.
1

1 2 1

1 2 4 2 1

1 2 4 8 4 2 1

1 2 4 8 16 8 4 2 1

1 2 4 8 16 32 16 8 4 2 1

1 2 4 8 16 32 64 32 16 8 4 2 1

1 2 4 8 16 32 64 128 64 32 16 8 4 2 1

3. A. WAP to count digits in a given number.


B. Explain the control statements in python in detail.

You might also like