0% found this document useful (0 votes)
3 views3 pages

String Programming Exercises

The document contains a comprehensive list of 38 string programming exercises in Python. These exercises cover various string operations such as finding length, copying, concatenating, comparing, and manipulating strings. The tasks also include counting characters, vowels, words, and handling occurrences of characters and words within strings.

Uploaded by

raushankr2k24
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

String Programming Exercises

The document contains a comprehensive list of 38 string programming exercises in Python. These exercises cover various string operations such as finding length, copying, concatenating, comparing, and manipulating strings. The tasks also include counting characters, vowels, words, and handling occurrences of characters and words within strings.

Uploaded by

raushankr2k24
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

List of string programming exercises

1. Write a python program to find length of a string.

2. Write a python program to copy one string to another string.

3. Write a python program to concatenate two strings.

4. Write a python program to compare two strings.

5. Write a python program to convert lowercase string to uppercase.

6. Write a python program to convert uppercase string to lowercase.

7. Write a python program to toggle case of each character of a string.

8. Write a python program to find total number of alphabets, digits or special character in a string.

9. Write a python program to count total number of vowels and consonants in a string.

10. Write a python program to count total number of words in a string.

11. Write a python program to find reverse of a string.

12. Write a python program to check whether a string is palindrome or not.

13. Write a python program to reverse order of words in a given string.

14. Write a python program to find first occurrence of a character in a given string.

15. Write a python program to find last occurrence of a character in a given string.

16. Write a python program to search all occurrences of a character in given string.
17. Write a python program to count occurrences of a character in given string.

18. Write a python program to find highest frequency character in a string.

19. Write a python program to find lowest frequency character in a string.

20. Write a python program to count frequency of each character in a string.

21. Write a python program to remove first occurrence of a character from string.

22. Write a python program to remove last occurrence of a character from string.

23. Write a python program to remove all occurrences of a character from string.

24. Write a python program to remove all repeated characters from a given string.

25. Write a python program to replace first occurrence of a character with another in a string.

26. Write a python program to replace last occurrence of a character with another in a string.

27. Write a python program to replace all occurrences of a character with another in a string.

28. Write a python program to find first occurrence of a word in a given string.

29. Write a python program to find last occurrence of a word in a given string.

30. Write a python program to search all occurrences of a word in given string.

31. Write a python program to count occurrences of a word in a given string.

32. Write a python program to remove first occurrence of a word from string.

33. Write a python program to remove last occurrence of a word in given string.

34. Write a python program to remove all occurrence of a word in given string.

35. Write a python program to trim leading white space characters from given string.

36. Write a python program to trim trailing white space characters from given string.
37. Write a python program to trim both leading and trailing white space characters from given string.

38. Write a python program to remove all extra blank spaces from given string.

You might also like