Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
27 views

4.string Assignment

This document provides 24 Python programming challenges involving string manipulation tasks such as calculating string length without len(), exchanging first and last characters, removing odd index characters, counting word occurrences, converting case, extracting substrings, sorting, removing newlines and spaces, capitalization, checking for duplicates, character counts, and determining palindromes. The challenges cover a wide range of basic string operations and testing concepts in Python.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

4.string Assignment

This document provides 24 Python programming challenges involving string manipulation tasks such as calculating string length without len(), exchanging first and last characters, removing odd index characters, counting word occurrences, converting case, extracting substrings, sorting, removing newlines and spaces, capitalization, checking for duplicates, character counts, and determining palindromes. The challenges cover a wide range of basic string operations and testing concepts in Python.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Write a Python program to calculate the length of a string without


using len().

2. Write a Python program to change a given string to a new string where


the first and last chars have been exchanged.

3. Write a Python program to remove the characters which have odd


index values of a given string.

4. Write a Python program to count the occurrence of words in a given


string.

5. Write a Python program that takes input from the user and displays
that input back in upper and lower cases.

6. Write a Python program to get a char in a string just before specified


substring.

7. Write a Python program to convert a given string to all uppercase if it


contains at least 2 uppercase characters in the first 4 characters.

8. Write a Python program to sort a string lexicographically(ascending).

9. Write a Python program to remove all newlines in a string.

10. Write a Python program to check whether a string starts with


specified characters

11. Write a Python program to reverse a string.

12. Write a Python program to print the index of each character in a


string.

13. Write a Python program to check if a string contains all vowels of the
alphabet.

14. Write a Python program to lowercase first n characters in a string.

15. Write a Python program to swap comma and dot in a string.


Sample string: "32.054,23"
Expected Output: "32,054.23"
16. Write a Python program to count and display the vowels of a given
text.

17. Write a Python program to split a string on the last occurrence of the
space.

18.Write a Python program to remove spaces from a given string.

19. Write a Python program to move spaces to the front of a given


string.

20. Write a Python program to capitalize first and last letters of a given
string.

21. Write a Python program to remove duplicate characters of a given


string.

22.WAP to find number of occurrences of character ‘o’ in the string


entered through keyboard. If the character ‘o’ is not present in the string
then show a message “o is not present in the entered string”.

23.WAP which read the string and print only vowel characters of entered
string on computer screen.

24.WAP that reads a string from keyboard and determine whether the
string is palindrome or not.

You might also like