Python automation


Joined
Jul 5, 2022
Messages
1
Reaction score
0
One package has a size of 10 cm * 5 cm * 3.6 cm.
The forwarder accepts a belt dimension of max. 300 cm.
The belt dimension is calculated as follows: 2 * width + 2 * height + longest side.
The longest side must not exceed 175 cm.
What is the maximum number of packages that can be delivered?
Solve in Python script.
 
Ad

Advertisements

Joined
May 11, 2022
Messages
47
Reaction score
3
. your problem is flawed. for a 3 dimension object the volume is calculated as simply width*height*length.
let's assume it's deliberate though. you want the equation
2*width/10 +2*height/5 +longest side/3.6
to be the maximum value, such that 2*width+2*height +longest length = 300
so for a progeam
Python:
width = 0
height = 0
longest_side = 0
best_fit = 0
for height in range(1,175):
   for width in range(1,175):
      longest_side = 300 -2*height - 2*width
      if longest_side > 175:
         continue
      else:
         if 2*width +2*height +longest_side > best_fit:
            best_fit =  2*width +2*height +longest_side
packege = best_fit/(10*5*3.6)
print packege
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top