Identify the first occurrence of the substring starting with the substring “the” and ending with the substring “end” in your string.

35 Greatest Speeches in History

Randomly select one of the “35 Greatest Speeches in History” (https://www.artofmanliness.com/character/knowledge-of-men/the-35-greatest-speeches-in-history/) using the following snippet of Python code

import random

print(random.randint(1,36))

Next, copy-and-paste the entire section from the website (including the title) and use it as your text string for the following regular expression exercises. Turn in your regular expression Python code solutions in a single Jupyter notebook.

Determine if the letter “q” (lowercase q) is in your string

Determine if the substring “peace” (with a lowercase p) is in your string

Determine if the word “peace” or “Peace” is in your string

Determine which numeric digits (0-9) are in your string at least once

Identify the first occurrence of the substring starting with the substring “the” and ending with the substring “end” in your string.

Identify all three letter lowercase words in your string.

Identify all words that start with a vowel in your string.

Identify the title of the speech in your string.

Identify the date and location of the speech in your string.

Replace all occurrences of the word “the” (lowercase or uppecase) with the word “THE”.

 

Identify the first occurrence of the substring starting with the substring “the” and ending with the substring “end” in your string.
Scroll to top