PYTHON ASSIGNMENT 2 - STRING


Read a string

     Check for empty string

     Display string length

     Display reverse of a string

     Character at a given position

     Index of a substring in a string

     Copy first n characters

     Copy last n character

     Copy n characters from mth position

     Convert all characters to uppercase

     Convert all characters to lower case

     Replace a character

     Delete a character

     Count number of vowels

     Split a string based on the spaces / delimiter



Write a program to read and join a list of strings

Write a program to check if a given string is a palindrome or not.

Write a program to count and display the number of capital letters in a given string.

Write a program to count the number of vowels in a string.

Write a program to display the number of times each vowel occurs in a string. (ignore case)

Write a program to remove all punctuations and special characters (~!@#$%^&*()_{}[]\:”;’<>?,./) in a given string.

Write a program to read a string and count and display the number of upper, lower, digit and special characters in a given string.

Write a Python program to accept a string and display the resultant string in a reverse order. The resultant string should contain all characters at the even position of accepted string ignoring blank spaces.
     Example:
          Given string: An apple a day keeps the doctor away
          Required output: ywrtoetpeydepaA

Given a string containing both upper and lower case letters, write a python program to count the number of repeated characters and display the maximum count of a character along with the character
     Sample input: ABaBCbGc
     Output:
          2A
          3B
          2C
          1G
          B is repeated 3 times

Consider 2 strings string1 and string2 and display the merged_string as output. The merged_string should be capital letters from both the strings in the order they appear.
     Sample Input:
     String1: I Like Java
     String2: Mary Likes Python
     merged_string: ILJMLP




No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu