Python String Exercises
1. Create a string variable with your name and print it.
2. Print the length of a given string.
3. Print the first and last character of a string.
4. Slice and print the first 3 characters of a string.
5. Slice and print the last 3 characters of a string.
6. Reverse a given string and print it.
7. Concatenate two strings and print the result.
8. Repeat a string 5 times and print it.
9. Check if the word 'Python' is in a given sentence.
10. Convert a string to uppercase.
11. Convert a string to lowercase.
12. Replace 'world' with 'Python' in the string 'Hello world'.
13. Find the index of the character 'a' in a string.
14. Count how many times the letter 'e' appears in a string.
15. Remove all spaces from a string.
16. Split a sentence into a list of words.
17. Join a list of words into a single string separated by hyphens.
18. Check if a string starts with 'Hello'.
19. Check if a string ends with '!'.
20. Capitalize the first letter of a string.
21. Swap the case of all characters in a string.
22. Center a string within 20 characters width, padded by '*'.
23. Remove leading and trailing spaces from a string.
24. Check if a string is numeric.
25. Check if all characters in a string are alphabetic.
26. Create a multi-line string and print it.
27. Format a string to include variables (e.g., name and age).
28. Get the ASCII value of a character.
29. Convert an integer ASCII value back to a character.
30. Print each character of a string on a new line using a loop.