Student Learning
Home
(current)
Aptitude
Class
FYBCA
SYBCA
TYBCA
Reading
About
FeedBack
Search
A1. Write a program to replace all occurrences of ‘a’ with $ in a String. (Ex. apple then output is $pple).
A2. Write a Python program to count the number of characters (character frequency) in a string.
Sample String: google.com'
Expected Result : {'o': 3, 'g': 2, '.': 1, 'e': 1, 'l': 1, 'm': 1, 'c': 1}
A3. Write a Python program to get a string made of the first 2 and the last 2 chars from a given a string. If the string length is less than 2, return instead of the empty string.
Sample String : 'General12'
Expected Result : 'Ge12'
Sample String : 'Ka'
Expected Result : 'KaKa'
Sample String : ' K'
Expected Result : Empty String
A4. Write a Python program to calculate the Length of a String without using a Library Function.
A5. Write a Python program to get a single string from two given strings, separated by a space and swap the first two characters of each string.
Sample String: 'ppk', 'abc’
Expected Result: 'abkppc’
B1. Write a python program to check if a string is a Palindrome or Not
B2. Write a Python program to calculate the Number of Digits and Letters in a string
B3. Write a Python program to remove the characters which have odd index values of a given string
B4. Write a Python program to count the occurrences of each word in a given sentence.
C1. Remove special symbols/Punctuation from a given string.
Given: str1 = "/*Sachin is @Cricketer& kind person"
Expected Output: “Sachin is Cricketerkind person”