31.Programming Assignment 7 (using strings)

Now you can try the following program based on strings.

1. Read a string of alphabets. Find the length. Number of vowels and consonants in the given sting.
2.Check whether the given string is palindrome or not. (use slicing..refer example...University question)
3.Check whether the given string is palindrome or not. (use for loop to reverse the string Hint: take the character from last position to the beginning and concatenate to a new string)
4.Check whether the given string is palindrome or not with out reversing the string(use a loop and check character by character..refer example...university question)
5. Count the number of occurrences of a character in a given string.( do not use count())
6. Read a string and split the string at positions of the letter ‘s’ ( use split())
7. Print the positions of occurrences of a character(index) in a given string.
8. Program to remove all occurrence of a substring ( or a character) from a string.(refer example program )
9. Program to replace all occurrence of a substring ( or a character) with a new string.
10. Change the case( small letter into capital and capital into small) of all characters in a string. ( refer example programs)
11. Print all the characters from a string till the first occurrence of a vowel. ( use break)
12. Print all the non vowel characters from a string.( use continue)
13.Read a string which consist of lower case/ uppercase letters and digits. Write a program to count each. Use string functions ( islower(), isupper(),isdigit())
14.Remove all punctuation from a string.( use string.punctuation)
15.Remove all vowels from a string(university question)
16.Write a program to convert all small letters into capital letters.(university question)
17.Find the number of occurrence of a given sub-string(university question)
18.Decimal to binary conversion without using built in function( refer example)
19.Convert a decimal number to octal( do not use built in function)
20.Convert the given decimal number to hexadecimal( do not use built in function)
21.Convert the given binary string to decimal.
22.Convert the octal number to decimal
23.Convert the hexa decimal number to decimal.
24.Write a Python program to check the validity of a password given by the user. ( refer example)
The Password should satisfy the following criteria:
1. Contains at least one letter between a and z
2. Contains at least one number between 0 and 9
3. Contains at least one letter between A and Z
4. Contains at least one special character from $, #, @
Minimum length of password: 6
25.Encrypt a string using the shift cipher( key=3 Ceaser cipher) ( refer example)

Comments

Popular posts from this blog

Python For Machine Learning - CST 283 - KTU Minor Notes- Dr Binu V P

KTU Python for machine learning Sample Question Paper and Answer Key Dec 2020

46.Classes and Objects in Python- Accessors and mutators