0% found this document useful (0 votes)
2 views5 pages

String

The document outlines a series of string manipulation tasks ranging from basic to advanced levels. It includes operations such as converting case, counting characters, checking for palindromes, and implementing custom functions. Additionally, it features challenges like creating a username generator and a mini chatbot.

Uploaded by

kana.k.002414
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)
2 views5 pages

String

The document outlines a series of string manipulation tasks ranging from basic to advanced levels. It includes operations such as converting case, counting characters, checking for palindromes, and implementing custom functions. Additionally, it features challenges like creating a username generator and a mini chatbot.

Uploaded by

kana.k.002414
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

1. Take a string input and print it in uppercase.

2. Take a string input and print it in lowercase.

3. Count the total number of characters in a string.

4. Print the first and last character of a string.

5. Reverse a string.

Example:

Input: hello
Output: olleh

6. Count vowels in a string.

Example:

Input: education
Output: 5

7. Count consonants in a string.

8. Check whether a character exists in a string or not.

9. Replace all spaces with _.

10. Count how many times a particular character appears.

Example:

Input: banana
Character: a
Output: 3

Easy-Intermediate Level

11. Check whether a string is palindrome or not.

Example:

madam → Palindrome
hello → Not Palindrome

12. Count words in a sentence.

13. Find the longest word in a sentence.

14. Remove all vowels from a string.


15. Print all characters one by one using loop.

16. Convert first letter of every word into uppercase.

Example:

hello world
Hello World

17. Find duplicate characters in a string.

Example:

programming
r, g, m

18. Check whether two strings are anagrams.

Example:

listen
silent

19. Remove duplicate characters from string.

Example:

programming
progamin

20. Count digits, alphabets, and special characters separately.

Intermediate Level

21. Find frequency of each character.

Example:

apple
a=1
p=2
l=1
e=1

22. Find the second most repeated character.

23. Compress a string.

Example:
aaabbccccd
a3b2c4d1

24. Expand compressed string.

Example:

a3b2c1
aaabbc

25. Remove all extra spaces from sentence.

Example:

"hello world"
"hello world"

26. Find all substrings of a string.

27. Find all permutations of a string.

28. Check if two strings are rotations of each other.

Example:

ABCD
CDAB

29. Find largest and smallest word in a sentence.

30. Sort words alphabetically.

Advanced Level

31. Find the first non-repeating character.

Example:

aabbcddee
c

32. Find the first repeating character.

33. Implement your own split() function without using split.

34. Implement your own replace() function.

35. Check whether a password is strong.

Conditions:
• At least 8 characters

• One uppercase

• One lowercase

• One digit

• One special character

36. Make a word guessing game.

37. Create a username generator from full name.

Example:

Kana Kumari
kana123

38. Encrypt a string using Caesar Cipher.

39. Decrypt Caesar Cipher.

40. Create a mini chatbot using string matching.

Loop + String Pattern Problems

41.

Input: PYTHON
Output:
P
PY
PYT
PYTH

42.

Input: PYTHON
Output:
PYTHON
PYTHO
PYTH

43.

Input: ABCDE
Output:
A
BB
CCC
DDDD

44. Print characters with index numbers.

Example:

0 -> H
1 -> e

45. Separate uppercase and lowercase characters.

Real Practice Challenge

46. Email validator

47. Phone number validator

48. Count emojis/special symbols in text

49. Find most common word in paragraph

50. Create a text-based login system using strings

You might also like