[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.