SILVERLINE PRESTIGE SCHOOL
ASSIGNMENT-1
SUBJECT : COMPUTER SCIENCE(083)
CLASS : XII
SESSION - 2025-26
TOPIC : String and its methods
DATE : 8/04/2025 DATE OF SUBMISSION : 14/04/2025
CREDITS ASSIGNED : 0.25
______________________________________________________________________________
1. Write a Python program to find the most frequent character in a string.
2. Write a Python program to remove all duplicates from a string and return the
result.
3. Write a Python program to count the occurrences of each word in a
sentence.
4. Write a Python program to capitalize the first letter of each word in a
sentence.
5. Write a Python program to find the longest word in a sentence.
6. Write a Python program to check if two strings are anagrams.
7. Write a Python program to count the number of occurrences of a specific
substring in a string.
8. Write a Python program to find the index of the first occurrence of a
substring in a string.
9. Write a Python program to replace all occurrences of a substring with
another substring.
10.Write a Python program to find the length of the last word in a sentence.
11.Write a Python program to reverse the order of words in a sentence.
12.Write a Python program to check if a string is a valid email address.
13.Write a Python program to check if a string is a valid
URL.
14.Write a Python program to find the first non-repeated
character in a string.
15.Write a Python program to remove all leading and
trailing whitespaces from a string.
16.Write a Python program to find the common characters
between two strings.
17.Write a Python program to find the second most frequent
character in a string.
18.Write a Python program to check if a string contains
only unique characters.
19.Write a Python program to find the longest common prefix
among a list of strings.