Function Name: countSheets() Parameters: aList (list) Returns: total (int) or error message (str) Description: As you kn

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Function Name: countSheets() Parameters: aList (list) Returns: total (int) or error message (str) Description: As you kn

Post by answerhappygod »

Function Name Countsheets Parameters Alist List Returns Total Int Or Error Message Str Description As You Kn 1
Function Name Countsheets Parameters Alist List Returns Total Int Or Error Message Str Description As You Kn 1 (81.78 KiB) Viewed 24 times
please solve it as python
Function Name: countSheets() Parameters: aList (list) Returns: total (int) or error message (str) Description: As you know your TAs have to print your recitation sheets before every recitation. But due to limited budget, every TA is allowed to print twenty copies (at most) for every recitation. Help them distribute the work! Write a function that takes in a list which contains the name of the TAS and the number of copies they want to print. Return the total number of copies that will be printed out. If anyone in the list wants to print more than 20 copies, then return a string with an error message that says: "Sorry {name of TA}, but you can only print a maximum of 20 copies per person." If there is more than one TA who wants to print more than 20 copies, then return the error message using the name of the first person who demanded above the maximum. Note: The list will always follow the order [name, # of copies, name, # of copies, ...] >>> countSheets(["Karthik", 10, "Coco", 20, "Claire", 5]) 35 >>> countSheets(["Anupama", 10, "Coco", 30, "Karthik", 40, "Ankita", 15]) 'Sorry Coco, but you can only print a maximum of 20 copies per person.'
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply