Question 8: The following paragraph has been extracted from Ernest Hemingway's Wikipedia Page. Write a Python program to implement the following instructions. Do
not forget to comment your code using in-line or multi-line comments.
1. Assign the paragraph to a string variable called my_text.
2. Create a birthdate string variable and store Hemingway's birthdate in it using the string slicing and indexing operations.
3. Calculate the number of characters in the last sentence of the paragraph, including spaces and punctuation marks, and store this value in a variable called length.
4. Count how many complete sentences are in the paragraph and store it in the variable sentences (Hint: sentences end with a period).
5. Calculate the number of words in the last sentence and store this in the variable word_count. A word is defined as any sequence of characters separated by a space or punctuation.
"Ernest Miller Hemingway (July 21, 1899 - July 2, 1961) was an American novelist, short-story writer, and journalist. Hemingway produced most of his work between the mid-1920s and the mid-1950s, and he was
awarded the 1954 Nobel Prize in Literature. He published seven novels, six short-story collections, and two nonfiction works. Three of his novels, four short-story collections, and three nonfiction works were
published posthumously. Many of his works are considered classics of American literature."
+ Code
+ Markdown
#1 Remove the ellipsis (...) and place your code and comments below for instruction 1.
my_text =
#2 Remove the ellipsis (...) and place your code and comments below for instruction 2.
birthdate =
#3 Remove the ellipsis (...) and place your code and comments below for instruction 3.
Add Markdown Cell
#4 Remove the ellipsis (...) and place your code and comments below for instruction 4.
sentences =
#5 Remove the ellipsis (...) and place your code and comments below for instruction 5.