![]() | |
Project 6: Assigned: Fri Nov 15 2024 In this project, you'll expand upon the last database and also include some documents using new schema. When you finish a part, you can test a subset of my final tests by downloading this tester script to the same folder as your code and running it. (Test early and often!) It doesn't guarantee a grade, but will run some of the tests I will run when grading. Part 0, 25 points: Let's go from one Elizabeth all the way back to the other one: Queen Elizabeth I. Add to your british-royals collection documents for the following british monarchs to follow the line of succession backwards in history: Part 1, 20 points: The name that a monarch chooses when they accede to the throne is called the "regnal name". E.g. King Charles III chose "Charles" in 2022. He shares that regnal name with the two prior King Charleses. Create a document for each regnal name used by the reigning monarchs we've included. We don't want to include the "regnal number", because multiple monarchs will share the same regnal name. You can choose whichever fields you like for this, but do include a name field so I have a known method to find them. E.g., there should be a regnal name document with "name" : "Charles". Important: Consorts are not the ruling monarch. This is why Queen Elizabeth II's mother was not Elizabeth II herself. However, William III and Queen Mary II were co-monarchs (neither was the consort) so they both had regnal names. Part 2, 10 points: Write a python function, get_regnal_name(collection, full_name), that takes the full name of a royal and, if they were a monarch, returns their regnal name as a string. If they did not accede to the English throne, then it should return None. Naturally, you'll have to update things in your database to make this happen. There are multiple ways to do it. Feel free to come talk to me if you're not sure which way to use. Part 3, 10 points: Write another python function, get_monarchs_by_name(collection, regnal_name), that returns a list of the full names of the monarchs who used the given regnal name. Just as before, there are multiple ways to get this part to work. Part 4, 10 points: Write another python function, get_reign_range(collection, royal_name), that returns a 2-tuple (yes, it must be a tuple) with the start and end years for the monarch's reign. If a non-monarch's name is given, it should return None. If there is no end date, use the current year. You will need to add more data to your database, and, again, there are multiple ways to do this. Please come chat with me if you want to talk through some ideas. Part 5, 10 points: Write a python function, get_reign_lengths_by_length(collection), that returns a list of the lengths (in years) of all the reigns, sorted from shortest to longest. You should estimate the length just using the numbers of the range of their reign, so sadly King Edward VIII's reign should come out as zero years, even though he served for 327 days. Part 6, 10 points: Write a python function, get_royal_names_by_reign_lengths(collection), that returns a list of the royal names of the monarchs, sorted from longest to shortest reign. (You can break ties any way you like.) Part 7, 5 points: One more python function. Write get_regnal_name_length(collection, regnal_name), that returns an integer with the total number of years that monarchs with that regnal name reigned. The numbers for Mary, Edward, and William will be a bit incorrect, since we're not going back before Elizabeth I, but that's fine. Submitting your Project: Choose a team name that no other team will choose. Then make sure all your code is in a file labelled with your team name, followed by |