Question: This must be in Python!!! Read everything carefully!!! Dictionaries and File I/O What can I use? You may only use the following things. We are

This must be in Python!!! Read everything carefully!!!

Dictionaries and File I/O

What can I use?

You may only use the following things. We are quite unlikely to add to the list, but note there are some useful things that weren't available earlier in the semester. If you use something disallowed, it's not an honor code violation, you just won't get points for some or all of that function (still not fun!).

Restrictions

no modules may be imported. (this definitely includes the csv module do the work directly!)

Allowed

all basic expressions and statements

file reading: open(), close(), read(), readline(), readlines(), with syntax

dictionaries: len, get, clear, copy, keys, values, items, pop, popitem, update

all sets and set operations; all exception handling blocks/raises.

functions: len(), range(), min(), max(), enumerate(), int(), and any functions you write

list methods: remove(), insert(), append(), extend(), pop(), index()

string methods: split(), endswith(), startswith(), join(), insert(), index()

more: sorted(), sort(), reversed(), reverse()

calling other functions of the project (and your own defined helper functions). Please do this! J

merge_databases(db1, db2): accepts two databases. This function creates and returns a new database containing the entries from both sources. db1 and db2 can't be modified. When the same name-genderyear is encountered in both databases, we must add the counts of each together for the new database (pretend we are merging data from each state in the USA). The result must be re-ranked before returning it.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!