Python coding

Open Posted By: highheaven1 Date: 16/09/2020 Graduate Proofreading & Editing


We are producing two types of products, product A and product B. Product A is defective if the weight is greater than 10 lbs. Product B is defective if the weight is greater than 15 lbs. For a given product, we know its product_type and its weight. Design a program to screen out defective products. Starting the program with variable definition:

product_type = 'xxx'

weight = xxx

Hint: You need to figure out the product type first, and then check if the product is defective based on the weight. You may use a nested if statement like the following:

if product is A:

if product weight > 10:

the product is defective


if product weight >15:

the product is defective

But you need to translate the English into Python codes. 

As a challenge, you may also try a one-step if statement. such as :

if some condition is met:

the product is defective


the product is normal

And the key is the bolded “some condition”.

Category: Mathematics & Physics Subjects: Algebra Deadline: 12 Hours Budget: $120 - $180 Pages: 2-3 Pages (Short Assignment)