You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> You will use Python to sort laureates for one prize by last name, and then MongoDB to sort prizes by year:
129
+
130
+
1901: Röntgen
131
+
1902: Lorentz and Zeeman
132
+
1903: Becquerel and Curie and Curie, née Sklodowska
133
+
You'll start by writing a function that takes a prize document as an argument, extracts all the laureates from that document, arranges them in alphabetical order, and returns a string containing the last names separated by " and "
134
+
135
+
The Nobel database is again available to you as db. We also pre-loaded a sample document sample_doc so you can test your laureate-extracting function.
136
+
(Remember that you can always type help(function_name) in console to get a refresher on functions you might be less familiar with, e.g. help(sorted)!)
137
+
138
+
---
139
+
Complete the definition of all_laureates(prize). Within the body of the function:
140
+
-[x] Sort the "laureates" list of the prize document according to the "surname" key.
141
+
-[x] For each of the laureates in the sorted list, extract the "surname" field.
142
+
-[x] The code for joining the last names into a single string is already written for you.
143
+
-[x] Take a look at the console to make sure the output looks like what you'd expect!
0 commit comments