diff --git a/docs/wi23-final/index.html b/docs/wi23-final/index.html index 4a6e06e..5e15b48 100644 --- a/docs/wi23-final/index.html +++ b/docs/wi23-final/index.html @@ -139,7 +139,7 @@

Winter 2023 Final Exam


The DataFrame sat contains one row for most combinations of "Year" and -"State", where "Year"ranges between +"State", where "Year" ranges between 2005 and 2015 and "State" is one of the 50 states (not including the District of Columbia).

The other columns are as follows:

@@ -703,7 +703,10 @@


Problem 2.4

What type of test is being proposed above?

-

( ) Hypothesis test ( ) Permutation test

+

@@ -888,12 +891,12 @@

Problem 4

in the string s below.

s = '''
-In DSC 10 [3], you learned about babypandas, a strict subset 
-of pandas [15][4]. It was designed [5] to provide programming 
-beginners [3][91] just enough syntax to be able to perform 
-meaningful tabular data analysis [8] without getting lost in 
+In DSC 10 [3], you learned about babypandas, a strict subset
+of pandas [15][4]. It was designed [5] to provide programming
+beginners [3][91] just enough syntax to be able to perform
+meaningful tabular data analysis [8] without getting lost in
 100s of details.
-'''    
+'''

We decide to help Nicole extract citation numbers from papers. Consider the following four extracted lists.

Problem 4
 list2 = ['3', '15', '4', '5', '3', '91', '8']
 list3 = ['10', '3', '15', '4', '5', '3', '91', '8', '100']
 list4 = ['[3]', '[15]', '[4]', '[5]', '[3]', '[91]', '[8]']
-list5 = ['1', '0', '3', '1', '5', '4', '5', '3', 
+list5 = ['1', '0', '3', '1', '5', '4', '5', '3',
          '9', '1', '8', '1', '0', '0']

For each expression below, select the list it evaluates to, or select “None of the above.”

@@ -930,6 +933,13 @@

Answer: list3

+

This regex pattern \d+ matches one or more digits +anywhere in the string. It doesn’t concern itself with the context of +the digits, whether they are inside brackets or not. As a result, it +extracts all sequences of digits in s, including ‘10’, ‘3’, ‘15’, ‘4’, +‘5’, ‘3’, ‘91’, ‘8’, and ‘100’, which together form list3. This is +because greedily matches all contiguous digits, capturing both the +citation numbers and any other numbers present in the text.

@@ -959,6 +969,14 @@

Answer: list5

+

his pattern [\d+] is slightly misleading because the +square brackets are used to define a character class, and the plus sign +inside is treated as a literal character, not as a quantifier. However, +since there are no plus signs in s, this detail does not affect the +outcome. The character class atches any digit, so this pattern +effectively matches individual digits throughout the string, resulting +in list5. This list contains every single digit found in s, separated as +individual string elements.

@@ -988,6 +1006,14 @@

Answer: list2

+

This pattern is specifically designed to match digits that are +enclosed in square brackets. The \[(\d+)\] pattern looks +for a sequence of one or more digits \d+ inside square +brackets []. The parentheses capture the digits as a group, +excluding the brackets from the result. Therefore, it extracts just the +citation numbers as they appear in s, matching list2 exactly. This +method is precise for extracting citation numbers from a text formatted +in the verbose numeric style.

@@ -1017,6 +1043,14 @@

Answer: list4

+

Similar to the previous explanation but with a key difference: the +entire pattern of digits within square brackets is captured, including +the brackets themselves. The pattern \[\d+\] specifically +searches for sequences of digits surrounded by square brackets, and the +parentheses around the entire pattern ensure that the match includes the +brackets. This results in list4, which contains all the citation markers +found in s, preserving the brackets to clearly denote them as +citations.

@@ -1032,33 +1066,28 @@

Problem 5

parse it with BeautifulSoup.

Suppose soup is a BeautifulSoup object instantiated using the following HTML document.

-
<college>Your score is ready!</college>
-
-<sat verbal="ready" math="ready">
-    Your percentiles are as follows:
-    <scorelist listtype="percentiles">
-        <scorerow kind="verbal" subkind="per">
-            Verbal: <scorenum>84</scorenum>
-        </scorerow>
-        <scorerow kind="math" subkind="per">
-            Math: <scorenum>99</scorenum>
-        </scorerow>
-    </scorelist>
-    And your actual scores are as follows:
-    <scorelist listtype="scores">
-        <scorerow kind="verbal">
-            Verbal: <scorenum>680</scorenum>
-        </scorerow>
-        <scorerow kind="math">
-            Math: <scorenum>800</scorenum>
-        </scorerow>
-    </scorelist>
-</sat>
+
<college>Your score is ready!</college>
+
+<sat verbal="ready" math="ready">
+  Your percentiles are as follows:
+  <scorelist listtype="percentiles">
+    <scorerow kind="verbal" subkind="per">
+      Verbal: <scorenum>84</scorenum>
+    </scorerow>
+    <scorerow kind="math" subkind="per">
+      Math: <scorenum>99</scorenum>
+    </scorerow>
+  </scorelist>
+  And your actual scores are as follows:
+  <scorelist listtype="scores">
+    <scorerow kind="verbal"> Verbal: <scorenum>680</scorenum> </scorerow>
+    <scorerow kind="math"> Math: <scorenum>800</scorenum> </scorerow>
+  </scorelist>
+</sat>


Problem 5.1

-

Which of the following expressions evaluate to `“verbal”}? Select all -that apply.

+

Which of the following expressions evaluate to "verbal"? +Select all that apply.