0% found this document useful (0 votes)
20 views

11 CS BT2 Assignment File

The document provides instructions for a Computer Science practical file, outlining 20 programming problems to be solved in Python across different data types like numbers, strings, lists, tuples, and dictionaries, with examples provided for problems involving patterns, series, character counting, lists, tuples, and dictionaries. Students are instructed to write the source code on ruled pages and output on white pages for each separate program in the assigned lab file by the given deadline.

Uploaded by

cinnamonchloe11
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

11 CS BT2 Assignment File

The document provides instructions for a Computer Science practical file, outlining 20 programming problems to be solved in Python across different data types like numbers, strings, lists, tuples, and dictionaries, with examples provided for problems involving patterns, series, character counting, lists, tuples, and dictionaries. Students are instructed to write the source code on ruled pages and output on white pages for each separate program in the assigned lab file by the given deadline.

Uploaded by

cinnamonchloe11
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

DPS RUBY PARK, KOLKATA

CLASS XI COMPUTER SCIENCE PRACTICAL FILE

Submission Deadline: 10th January,2024

Please note the following points:

i) Use the green colored lab file.


ii) Write the source code on the ruled pages and the output on the white pages.
iii) Write each programs in separate pages.

LOOP

1) Write a program in python to check whether a given number is Armstrong or not.

2) Write a program in python to display all the prime numbers in a given range of values.

3) Write a program in python to display the following patterns:

a) A
BC
DEF
GHIJ
KLMNO
b) *
**
***
****
*****
4) Write the code in python to display summation of the following series:
a) s= x+ x2 + x3 +……….+ xn (value of x and n to be taken from user)

b) s= 1 + (1+2) + (1+2+3) +……….+ (1+2+3+….+N) (value of N to be taken from user)

STRING

5) Write a program in Python to enter a string and print the highest occurrence of a particular
character consecutively.
Example: Enter a string: abcaaacacaaaabaaaaabbb
Output: aaaaa
6) Write a Python code to accept a name (containing three words) and display only the initials
(i.e. first letter of each word).
Sample input: LAL KRISHNA ADVANI
Sample output: L K A
7) Write a program to input a line of text and do the following:
i) Print the longest word from it.
ii) Display those words having first and last character same.
iii)Display the count of vowels in it.
8) Write a program in Python to enter a string.
i) Check whether it is palindrome or not
ii) Count and display number of digits, spaces and uppercase, lowercase letter.

LIST

9) Write a program to take a list of integers and do the following tasks:


a) display the largest value
b) display the average of all the values
c) Display the list in reverse order
d) Arrange the list elements in descending order
e) Delete the last element of the list
10) Write a program in python to accept a list of integers and add 10 with each even element of
the list and multiply every odd elements by 5. Display the modified list.
Example: input: L=[10,15,12,18]
output: L=[20,75,22,28]
11) Write a program to take two list L1 and L2 and perform the following tasks:
a) Display the union of L1 and L2.
b) Display the intersection of L1 and L2.
c) Display the number of occurrence of each element of L1 in L2.
d) Remove the duplicate elements from L2.
12) Write a program in python to accept a list L of integer elements. Create two new list L1 and
L2 so that L1 contains all even values and L2 contains all the odd values of L. Display L1 and
L2.
Example: L=[111,12,13,14,15]
L1=[12,14]
L2=[111,13,15]
TUPLE

13) Consider a tuple of non-zero numbers. Write a program in Python to shift the negative
numbers to right and the positive numbers to left so that the resultant list will be as follows :
Original tuple: (-2,1,-3,-15,16,-17,5,-3,-6)
Output should be: (1,16,5,-6,-3,-17,-15,-3,-2)
14) Given a tuple of pairs = ((2, 5), (4, 2), (9,8), (12,10)), count the number of pairs (a, b) such
that both a and b are even.
15) Write a program in python to enter a tuple of integers and remove all the duplicate
occurrence.
16) Write a program to input ‘n’ numbers in a tuple and separate the tuple in the following
manner.
Example
T=(10,20,30,40,50,60)
Tl=(10,30,50)
T2=(20,40,60)

DICTIONARY

17) Write a program in python to take a list of some integer values. Create a dictionary from the
list such that keys will be every elements of list and values will be cube of each element.
Example: L=[2,3,4]
D={2:8,3:27,4:64}
18) Write a python program to input the name of students with their age as key-value pairs of a
dictionary and perform the following operations:
i) Ask user to enter any name and delete that particular pair.
ii) Display only the name of every student.

19) Declare a dictionary in python whose keys are month names and values are the number of
days in the corresponding months.
i) Ask the user to enter a month name and use the dictionary to display number of days in
that particular month.
ii) Display all of the months with 31 days.

20) Write a program to take a list of numbers and perform the following task:
i) Display the number of occurrence of every number in dictionary format.
Example: l= [1, 2, 3,2,1,5,5,2]
i) d={1:2,2:3,3:1,5:2}

You might also like