Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 3 In this problem you will write a function that simulates an IT help desk work session. An IT technician opens the door for
Python 3
In this problem you will write a function that simulates an IT help desk work session. An IT technician opens the door for a free repair session, and, realizing there is already a long line of clients waiting outside, he starts taking people right away Write a function session.simulator ) that takes two arguments, in this order: 1. clients: a list of integers in which each integer represents the minutes required to resolve a particular client's technical problem. 2. regular: the amount of regular time (in whole minutes) that the technician planned to stay for this help session In addition, the IT technician helps clients by the following rules: . First let's understand how time works in this problem. For simplicity, say the regular help session is 3 minutes long. If the first client takes 3 minutes, then the regular session is considered ended. Any additional time that this client needs or that other clients need will be reduced according to the rules described below. . The technician takes clients in order one-by-one: first come, first served. You may assume that no new clients arrive once the session has started. Because the technician is nice, he will help all the clients even when the session has officially ended. However, any clients he takes after the regular session time has ended will receive only half of the normal time that the client would have required. Note: you must use integer division to compute the reduced time amount. This means that if the normal time required is 7, then the shortened time will be (the normal time required // 2) - (7 / 2)3 . When a client arrives during regular time but needs more time than the technician has remaining in the regular session, the client will receive all of the remaining time in regular session, plus half of the excess time the client wanted. Fo are only 4 minutes remaining. The client will be given all 4 minutes of the remaining time plus half of the excess 6 minutes that he wanted: 4 (10-4//2 -7 minutes total. r example, suppose a client needs 10 minutes of the technician's time but there Your function should keep running until all clients have been helped. The function should return the total time spent spent by the technician (in minutes). You may assume that all arguments will be valid. However, it is possible that no client shows up for the help session. In that case, the function should simply return 0 (helped nobody). Important: Please keep in mind that we are using integer divisions throughout this function Examples Function Call session simulator ([5, 5], 10) session.simulator ([1, 5, 4, 11], 10) 15 session.simulator ([5, 7, 5, 6], 20) 21 Return Value 10Step 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