Question
Suppose we have records on the daily sales of several sellers. We're interested in a subset of those sellers, and of the subset we're interested
Suppose we have records on the daily sales of several sellers. We're interested in a subset of those sellers, and of the subset we're interested in, we want to identify those with the highest daily sales average. Let's look at an example:
Given a matrix of records:
Alice 3 Bob 4 Alice 6 Cathy 2 Bob 10 Bob 7
and the subset of sellers "Alice Cathy", we can determine that Alice has the highest daily average of 4.5. Note that Bob has a higher overall daily average of 7, but we didn't specify him in our subset.
For this task we will make the following assumptions:
Each row in the matrix is exactly 2 elements long, with the first element being a string and the second element being a number
Matrices are always 2 dimensional and non-empty
The subset of sellers of interest must appear in the matrix
The output should be the name of the seller in the requested subset who has the highest daily sales average. However, if more than one seller is tied for the maximum, all names should be output, separated by spaces.
Input:
The rows of the matrix each on a separate line, followed by a blank line, and then seller names.
Output:
Print to standard output either the name(s) of the sellers in the subset with the highest daily sales average, or the string NONE if assumptions are not fulfilled.
python 3
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