Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN PYTHON! 2. Screws and Nuts Let's assume you are maintaining a portion of an airplane and in the midst of your work, your technician

image text in transcribed

IN PYTHON!

2. Screws and Nuts Let's assume you are maintaining a portion of an airplane and in the midst of your work, your technician has run out of screws. You request for some additional screws and nuts from your hardware department and the hardware department sends you a large shipment of screws and nuts. The shipment comes and it is in all shapes and sizes, but your technician says that he can perhaps try to differentiate the different screws by their weight. As the shipment is huge, he asks for your help. He says that: if the screw has weight 3, it belongs to Screw A. if the screw has weight 6, it belongs to Screw B. if the screw has weight 12, it belongs to Screw C. For all other screws, please discard them. if the nut has weight 1, it belongs to Nut A. if the nut has weight 4, it belongs to Nut B. if the nut has weight 8, it belongs to Nut C. For all other nuts, please discard them. You are now provided with a list of all the weights of the screws or nuts: [3, 6, 12, 3, 6, 12, 1,4,8,3,4] Your task is to return a list saying the number of pairs of Screw and Nut Set A, Screw and Nut Set B. Screw and Nut Set C. In the above example, number of Screw and Nut Set A is 1 In the above example, number of Screw and Nut Set B is 2 In the above example, number of Screw and Nut Set C is 1 So the return value is [1, 2, 1]

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_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Complexity of linear search is O ( n ) . Your answer: True False

Answered: 1 week ago