Question: 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

 IN PYTHON! 2. Screws and Nuts Let's assume you are maintaining

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!