0% found this document useful (0 votes)
33 views5 pages

Class XI Practical File Part-II

The document contains a series of practical programming exercises for Class XI Computer Science students. It includes tasks such as finding the median of a list, removing duplicates, manipulating strings, and performing various operations on lists and arrays. Each question is designed to enhance students' understanding of Python programming concepts and data manipulation.

Uploaded by

oorjitcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views5 pages

Class XI Practical File Part-II

The document contains a series of practical programming exercises for Class XI Computer Science students. It includes tasks such as finding the median of a list, removing duplicates, manipulating strings, and performing various operations on lists and arrays. Each question is designed to enhance students' understanding of Python programming concepts and data manipulation.

Uploaded by

oorjitcs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

PRACTICAL FILE QUESTIONS

CLASS XI CSC

Q Write a program to read a list of n integers and find


their median.
Q Write a program to read a list of elements. Modify this list so that it does not contain any
duplicate elements, i.e., all elements occurring multiple times in the list should appear only
once.
Q Write a program to create a list of elements. Input an element from the user that has to be
inserted in the list. Also, input the position at which it is to be inserted.
Write a program to read elements of a list and do the following:
(a) The program should ask for the position of the element to be deleted from the list and
delete the element at the desired position in the list.
(b) The program should ask for the value of the element to be deleted from the list and delete
this value from the list.
WAP to multiply an element by 2 if it is odd index for a given list containing both numbers
and strings.
WAP to count the frequency of an element in a given list.
An array Num contains the following elements:
3, 25, 13, 6, 35, 8, 14, 45
Write a function to swap the content with next value divisible by 5 so that the resultant array
looks like:
25, 3, 13, 35, 6, 8, 45, 14

The record of a student (Name, Roll No, Marks in five subjects and percentage of marks) is
stored in the following list:
stRecord = ['Raman', 'A-36', [56, 98, 99, 72, 69], 78.8]
Write Python statements to retrieve the following information from the list studRecord.
(i) Percentage of the student
(ii) Marks in the fifth subject
(iii) Maximum marks of the student
(iv) Roll No. of the student
(v) Change the name of the student from 'Raman' to 'Raghav'.
Q Write a program to find all duplicates in a list.
Q Python program to check whether the string is Symmetrical or Palindrome
Q Reverse Words in a Given String in Python
Input : str =" geeks quiz practice code"
Output : str = code practice quiz geeks
Input : str = "my name is laxmi"
output : str= laxmi is name my
Q Python – Avoid Spaces in string length
Given a String, compute all the characters, except spaces.
Input : test_str = ‘geeksforgeeks 33 best’
Output : 19
Explanation : Total characters are 19.
Input : test_str = ‘geeksforgeeks best’
Output : 17
Explanation : Total characters are 17 except spaces.
Q Python program to print even length words in a string
Given a string. The task is to print all words with even length in the given string.
Examples:
Input: s = "This is a python language"
Output: This is python language
Input: s = "i am laxmi"
Output: am
Q Python – Uppercase Half String
Given a String, perform uppercase of the later part of the string.
Input : test_str = 'geeksforgeek'
Output : geeksfORGEEK
Explanation : Latter half of string is uppercased.
Input : test_str = 'apples'
Output : appLES
Explanation : Latter half of string is uppercased.
Q Python program to capitalize the first and last character of each word in a string
Given the string, the task is to capitalize the first and last character of each word in a string.
Examples:
Input: hello world
Output: HellO WorlD
Input: welcome to geeksforgeeks
Output: WelcomE TO GeeksforgeekS
Q Python program to check if a string has at least one letter and one number
Given a string in Python. The task is to check whether the string has at least one
letter(character) and one number. Return “True” if the given string fully fill the above
condition else return “False” (without quotes).
Examples:
Input: welcome2ourcountry34
Output: True
Input: stringwithoutnum
Output: False
Q Python | Count the Number of matching characters in a pair of string
Given a pair of non-empty strings. Count the number of matching characters in those strings
(consider the single count for the character which have duplicates in the strings).
Examples:
Input : str1 = 'abcdef'
str2 = 'defghia'
Output : 4
(i.e. matching characters :- a, d, e, f)

Input : str1 = 'aabcddekll12@'


str2 = 'bb2211@55k'
Output : 5
(i.e. matching characters :- b, 1, 2, @, k)
Q Find words which are greater than given length k
A string is given, and you have to find all the words (substrings separated by a space) which
are greater than the given length k.
Examples:
Input : str = "hello geeks for geeks
is computer science portal"
k=4
Output : hello geeks geeks computer
science portal
Explanation : The output is list of all
words that are of length more than k.
Input : str = "string is fun in python"
k=3
Output : string python
Q Python program to find uncommon words from two Strings
Given two sentences as strings A and B. The task is to return a list of all uncommon words.
A word is uncommon if it appears exactly once in any one of the sentences, and does not
appear in the other sentence. Note: A sentence is a string of space-separated words. Each
word consists only of lowercase letters.
Examples:
Input : A = “Geeks for Geeks”, B = “Learning from Geeks for Geeks”
Output : [‘Learning’, ‘from’]
Input : A = “apple banana mango” , B = “banana fruits mango”
Output : [‘apple’, ‘fruits’]
Q Python | Swap commas and dots in a String
The problem is quite simple. Given a string, we need to replace all commas with dots and all
dots with the commas. This can be achieved in many different ways.
Examples:
Input : 14, 625, 498.002
Output : 14.625.498, 002

You might also like