Question
counts = [1900,google.com, 160,mail.google.com, 20,mobile.sports.yahoo.com, 10,sports.yahoo.com, 5,stackoverflow.com, 1,en.wikipedia.org, 2,es.wikipedia.org, 1,mobile.sports] Write a PYTHON function that takes this input as a parameter and returns a data
counts = ["1900,google.com", "160,mail.google.com", "20,mobile.sports.yahoo.com", "10,sports.yahoo.com", "5,stackoverflow.com", "1,en.wikipedia.org", "2,es.wikipedia.org", "1,mobile.sports"]
Write a PYTHON function that takes this input as a parameter and returns a data structure containing the number of hits that were recorded on each domain AND each domain under it. For example, an impression on "mail.yahoo.com", counts for "mail.yahoo.com", "yahoo.com", and "com" (Subdomains are added to the left of their parent domain. So "mail" and "mail.yahoo" are not valid domains. Note that "mobile.sports" appears as a separate domain as the last item of the input.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started