Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 5: Write a function that takes an ID as a parameter, and returns the country associated with that ID. Call this function getCountry. Inside

image text in transcribed
image text in transcribed
Problem 5: Write a function that takes an ID as a parameter, and returns the country associated with that ID. Call this function "getCountry". Inside of your function, you should be making use of the countryMembership dictionary that you created earlier (or a list generated from that dictionary's items) in order to solve this problem. Test your function by printing out the result of calling it and passing in the user ID 23. The country returned and printed should be Canada. Problem 6: Using your function (by making calls to it), go through the message data and count up and display how many messages were sent by users from Canada. Also count up and display how many were received by users from Canada Problem 7: Create another dictionary with each country as a key, and as a value for each country key there should be a list of two numbers. The first number is the count of sent messages from that country. The second number is the count of received messages from that country. Print your dictionary. It should take on the following format (this is not real data): United States': [2, 4], Canada': [5, 3], 'Italy [1, 2])

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Give two advantages of Infrastructure as a Service (IaaS).

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago