Question: IN PYTHON! 1. Screws Let's assume you are maintaining a portion of an airplane and in the midst of your work, your technician has run

 IN PYTHON! 1. Screws Let's assume you are maintaining a portion

IN PYTHON!

1. Screws 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 from your hardware department and the hardware department sends you a large shipment of screws. 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 to 5 grams (inclusive), it belongs to Screw A. if the screw has weight 6 to 9 grams (inclusive), it belongs to Screw B. if the screw has weight 12 to 20 grams (inclusive), it belongs to Screw C. For all other screws, please discard them. You are now provided with a list of all the weights of the screws: [3.5,7,28, 15, 4, 8] Your task is to return a list saying the number of type Screw A, Screw B, Screw C and other screws received. In the above example, number of Screw A is 2 (3.5, 4) In the above example, number of Screw B is 2 (7.8) In the above example, number of Screw C is 1 (15) In the above example, number of Screws to discard is 1 (28) So the return value is [2211]

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!