Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In a small building people are queued up in front of the elevator. Every person weighs a certain amount of kilograms and needs a lift

In a small building people are queued up in front of the elevator. Every person weighs a certain amount of kilograms and needs a lift to a specific floor within the building. Calculate how many courses we would need to transfer all the people to their desired floors while keeping within the elevator restrictions for weight and max people allowed inside and without breaking queue order. Moving from one floor to another counts as a course. Going back to ground floor is one course as well.

# [100, 160, 150, 30, 70, 200], [2, 4, 2, 6, 5, 3], 2, 250 # 11 # # [70, 80, 100], [2, 3, 5], 2, 150 # 5 # # [100, 70, 80], [3, 2, 2], 2, 150 # 4 # # [10, 20, 100, 20, 200, 30, 70], [2, 3, 4, 5, 6, 7, 8], 2, 200 # 11 #

def elevator_task(people, floors, max_ppl, max_kg):

image text in transcribed
Test Cases explanation
weight of passengers, floor on elevator the passenger needed to get to, max people, max weight
11 is what the first test case should print
# [100, 160, 150, 30, 70, 200], [2, 4, 2, 6, 5, 3], 2, 250 # 11
In a small building people are queued up in front of the elevator. Every person weighs a certain amount of kilograms and needs a lift to a specific floor within the building. Calculate how many courses we would need to transfer all the people to their desired floors while keeping within the elevator restrictions for weight and max people allowed inside and without breaking queue order. Moving from one floor to another counts as a course. Going back to ground floor is one course as well. # [100, 160, 150, 30, 70, 2001, 12, 4, 2, 6, 5, 3], 2, 250 #11 # # [70, 80, 100], [2, 3, 51, 2, 150 #5 # # [100, 70, 801, 13, 2, 2, 2, 150 # #4 # # [10, 20, 100, 20, 200, 30, 701, 12, 3, 4, 5, 6, 7, 81, 2, 200 #11 # def elevator_task(people, floors, max_ppl, max_kg)

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_2

Step: 3

blur-text-image_3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

More Books

Students also viewed these Databases questions

Question

6. Are my sources reliable?

Answered: 1 week ago

Question

5. Are my sources compelling?

Answered: 1 week ago