Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def gallery(visits, option:2): H H II Produce summary statistics of gallery visits. Parameters: visits: list of visits (see also HTML instructions): Each visit is a

image text in transcribed
image text in transcribed
def gallery(visits, option:2): H H II Produce summary statistics of gallery visits. Parameters: visits: list of visits (see also HTML instructions): Each visit is a tuple (room number (str), visitor number (str), time (str)) (all elements are integers in string format) Each visitor starts outside any room, and they leave all rooms in the end. The visits are not necessarily in order. option (int, optional}: determines what to return, see below Returns: a list containing tuples for each room (sorted in increasing number by room number (1, 2, 3, ...)): - if option I 0, (room number, number of unique visitors} - if option = 1, (room number, number of unique visitors, average visit time) - if option I 2, (room number, number of unique visitors, average visit time, highest total time spent in the room by a single visitor) - the average visit time is rounded to integer value. Example use: b>> ViSitS :[(I01f Ialf IZGI)' (IEJIif 'BI' I25I)' (Ill! Ill, I74I)' ('1', '1', '2')] >>> gallery(visits) [('3'.1.5. 5). ('131. 72. 72)] >>> gallery(visits, G) [('9', 1). ('1'.1)] >>> gallery(visits, 1} [('9'.1.5). V121. 72)] >>> gallery(visits, 1}[0] ('0'. 1. 5)

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

Step: 3

blur-text-image

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

Data Analytics For Accounting

Authors: Vernon Richardson

2nd Edition

1260904334, 9781260904338

More Books

Students also viewed these Economics questions