Python Lab Assignment
Python Lab Assignment
Program 1: Write a program to create a string made of the first, middle and
last character of the input string (Input: hello, Output: hlo).
Program 4: Write a Python program to print even length words in a string (Input:
s = "This is a python language" Output: This is python language).
Program 5: Write a Python program to modify a given string according to the
following:
Add ' ing ' at the end of a given string, if the length of it is at least
3.
If the given string already ends with ' ing ' then add ly '
If the string length of the given string is less than 3, leave it
unchanged.
Program 6: Find the number of occurrences of a substring in a given main string,
ignoring the case.
Program 7: Write a program to check whether two strings are anagrams (An
anagram of a string is another string that contains the same characters, only the
order of characters can be different) or not.
Program 8 : Write a program to find the longest word and the length of the
longest one in a string.
Program 9 : Given a sentence, count the frequency of words and find the word with max
frequency.