PRACTICAL ASSIGNMENT
CLASS – XII
TERM -1
2024-2025
1. Write a function LShift(Arr,n) in Python, which accepts a list Arr of numbers
and n is a numeric value by which all elements of the list are shifted to left.
Sample Input Data of the list
Arr= [ 10,20,30,40,12,11], n=2
Output
Arr = [30,40,12,11,10,20]
2. Write a function dispBook(BOOKS) in Python, that takes a dictionary BOOKS as an argument
and displays the names in uppercase of those books whose name starts with a consonant.
For example, Consider the following dictionary
BOOKS = {1:"Python", 2:"Internet Fundamentals ", 3:"Networking ", 4:"Oracle sets",
5:"Understanding HTML"}
The output should be:
PYTHON
NETWORKING
3. Write a Python Program containing a function FindWord(STRING, SEARCH), that accepts two
arguments : STRING and SEARCH, and prints the count of occurrence of SEARCH in STRING.
Write appropriate statements to call the function.
For example, if STRING = "Learning history helps to know about history with interest in
history" and SEARCH = 'history', the function should display the word history occurs 3 times.
4. Write a suitable Python statement for each of the following tasks using built-in
functions/methods only:
i) To delete an element Mumbai:50 from Dictionary D.
ii)To display words in a string S in the form of a list.
5. Write a Python Program to display alternate characters of a string my_str.
For example, if my_str = "Computer Science". The output should be Cmue cec.
6. Write a function, lenWords(STRING), that takes a string as an argument and returns a tuple
containing length of each word of a string. For example, if the string is "Come let us have
some fun", the tuple will have (4, 3, 2, 4, 4, 3)
7. Write the Python statement for each of the following tasks using BUILT-IN
functions/methods only:
(i) To insert an element 200 at the third position, in the list L1.
(ii) To check whether a string named, message ends with a full stop
/ period or not.
8. Write a function INDEX_LIST(L), where L is the list of elements passed as argument to the
function. The function returns another list named ‘indexList’ that stores the indices of all
Non-Zero Elements of L.
For example:
If L contains [12,4,0,11,0,56]
The indexList will have - [0,1,3,5]
9. Write a function Sum3(L) in Python , which accepts a list L of integers and displays the sum
of all such integers from the list L which end with the digit 3.
For example if the list L=[123,10,13,55,83] is passed the the function should return the sum
of 123,13,83 = 219.
10. Write a program using function to accept a list as parameter and multiply all the odd
elements by 5.
11. Write a program using function to insert new element in sorted list.
12. Write a program using function to accept the list as parameter and print the prime numbers
of the list.
13. Write a program using function to count the number of elements in a list within a specified
range.
14.
15.