Instructions: Write answers to these questions in jupyter notebook and submit the
assignment on this drive link upload_link by naming it as
“python_string_assignment_your_name.ipynb”
1. Create a string variable named `my_string` with the value "Hello, Python!".
2. Print the third character of `my_string`.
3. Use slicing to print the substring "Python" from `my_string`.
4. Concatenate `my_string` with another string " Welcome to the world of programming!" and
print the result.
5. Format the following variables into a string: `name = "Alice"`, `age = 30`, `country =
"USA"`. The output should be "Alice is 30 years old and lives in USA".
6. Create a string with multiple occurrences of a character, such as "aaabbbccc". Count and
print the number of occurrences of the character 'b'.
7. Convert the string "HELLO" to lowercase using a string method.
8. Write a program that takes a sentence as input and counts the number of vowels (a, e, i,
o, u) in the sentence.
9. Use string interpolation to create a formatted string that includes variables `x = 10` and `y
= 20`. The output should be "The value of x is 10 and y is 20".
10. Reverse the string "python" using slicing.
11. Write a program that takes a sentence and a word as input and checks if the word is
present in the sentence.
12. Replace all occurrences of 'a' with 'e' in the string "banana" and print the modified string.
13. Remove any leading or trailing whitespace characters from the string " Python ".
14. Split the string "Hello,World,Python" into a list of words and print the list.
15. Check if the string "racecar" is a palindrome (reads the same forwards and backwards).
16. Write a program that capitalizes the first letter of each word in a given sentence.
17. Find the index of the first occurrence of the substring "Python" in the string "Hello,
Python Programming".
18. Join the elements of a list ['apple', 'banana', 'cherry'] into a single string separated by
commas.
19. Write a program that takes a string input and prints the string in reverse order.
20. Use string formatting to create a table-like output for the following data: `name = "John"`,
`age = 25`, `country = "USA"`.