Question 1¶
Q1a¶
q1ashould be exactly the first 200 characters ofdata/nyt_articles.txt:
{"web_url":{"0":"https:\/\/www.nytimes.com\/2020\/01\/01\/well\/move\/exercise-physical-activity-workout-time.html","1":"https:\/\/www.nytimes.com\/2020\/01\/01\/world\/europe\/pope-francis-slap-videoQ1b¶
The answer is B.
Question 2¶
Q2a¶
The index of
datesshould match the index ofnews_df.datesshould have exactly the columnsYear,Month, andMinute.dates["Year"].loc[291]should be2020.dates["Month"].loc[593]should be2.dates["Minute"].value_counts()[45]should be96.
Q2bi¶
The answer is B.
Q2bii¶
The answer is A.
Q2c¶
modified_patternshould match only the first quote in:'"A quote within marks should be captured."But not this part, which is inside another pair of quotes."'The expected output is:
['"A quote within marks should be captured."']modified_patternshould not match a quote that does not end with one of the required punctuation marks:'"A quote within marks but without punctuation shouldnt be matched"'The expected output is:
[]modified_patternshould not match text without quotation marks:'Your sentence should involve a quote.'The expected output is:
[]modified_patternshould match a quote ending in a question mark:'"TESTING FOR QUESTION MARK?"'The expected output is:
['"TESTING FOR QUESTION MARK?"']modified_patternshould match a quote ending in an exclamation mark:'"TESTING FOR EXCLAMATION MARK!"'The expected output is:
['"TESTING FOR EXCLAMATION MARK!"']
Q2d¶
The total number of
New Yearmentions should be447.The total number of
GPT Modelmentions should be189.
Question 3¶
Q3ci¶
The first row of
top_negative["lead_paragraph"]should start with:The day after Labor Day has got to be one of the worst days in the AmericanThe first row of
top_positive["lead_paragraph"]should be:Happy New Year, audiophiles!