Starting our ascent
Throughout this course, we will gradually build up a set of tools to examine the proportion of Nobel prizes that were awarded to immigrants. In this exercise, you will answer a limited but related question using tools we have introduced so far.
We saw from his laureate document that Walter Kohn's country of birth was "Austria" and that his prize affiliation country was "USA". Count the number of laureates born in Austria with a prize affiliation country that is not also Austria.
This exercise is part of the course
Introduction to MongoDB in Python
Exercise instructions
- Save a filter
criteria
for laureates born in (bornCountry
) "Austria" with a non-Austriaprizes.affiliations.country
. - Save your count of laureates as
count
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Filter for laureates born in Austria with non-Austria prize affiliation
criteria = {____: ____,
____: {"$ne": ____}}
# Count the number of such laureates
count = db.laureates.count_documents(criteria)
print(count)