Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- # This code is going to help load a product into different sized containers without going over the total Capacity of a single contaiter and well as the sum of all of the containers.
- #First you input the total gallons you wish to load. second enter the loading compacity for each container(Pot).
- product = int(input ('Enter Gallons: '))
- print( 'Lets get started! You entered', product, 'gals')
- Pot1 = int(input ('Enter size of first pot: '))
- print ('First container', Pot1)
- Pot2 = int(input ('Enter size of second pot: '))
- print ('Second container', Pot2)
- Pot3 = int(input ('Enter size of third pot: '))
- print ('Third container', Pot3)
- Pot4 = int(input ('Enter size of forth pot: '))
- print ('Fourth container', Pot4)
- Pot5 = int(input ('Enter size of last pot: '))
- print ('Fifth container', Pot5)
- Pot= [Pot1,Pot2,Pot3,Pot4,Pot5]
- #def myfunc(a=4,b=6):
- #sum = a + b
- #return sum
- #myfunc()
- def totalPot():
- sum = Pot1+Pot2+Pot3+Pot4+Pot5
- return sum
- print
- print ('Total gallons for your trailer is: ', totalPot())
- #if the total of the product exceed the total of what the pots can hold combined.
- if totalPot() < product:
- print ("WARNING! YOU HAVE TOO MUCH PRODUCT FOR YOUR TRAILER!")
- sys.exit()
- else:
- print ("The product will fit in your trailer! One moment while I deposit your product in the pots")
- # this part ofvthe code is suppose to fill the the pots from the largest to the smallest.
- if product <= Pot1:
- print ("Pot 1 filled")
- else:
- print ("Complete! Pot 1 filled")
- if product<= Pot1+Pot5:
- print ("Pot 5 and Pot 1 filled")
- else:
- print ("Complete! Pot 1 and 5 are filled")
Add Comment
Please, Sign In to add comment