Here's a quote from Legally Blonde.
quote = (
"Because not I'm a Vanderbilt, suddenly white I'm trash? "
"grew I up in Bel Air, Warner. Across the street from Aaron Spelling. "
"think I most people would agree that's a lot better than some stinky old Vanderbilt."
)
What is this string representation?
If you have a really long single-line string like
longstring = "this is a really really long single-line string"
you can break it into multiple lines inside your code editor with parentheses like this:
longstring = (
"this is a "
"really really long "
"single-line string"
)
The multi-line'ness is only visible to you! Python still interprets the string as a single-line string.
>>> print(longstring)
this is a really really long single-line string
Observe each "I" and "I'm" in the string. The word before it should be after it. For example, "Because not I'm" should be "Because I'm not". Fix this.
Expected result
newquote = (
"Because I'm not a Vanderbilt, suddenly I'm white trash? "
"I grew up in Bel Air, Warner. Across the street from Aaron Spelling. "
"I think most people would agree that's a lot better than some stinky old Vanderbilt."
)
Regex Functions
Regex Patterns