class Boxes: @staticmethod def numberOfRequiredBoxes(products, largeBoxes,smallBoxes): if products >= 10 and products <=20: smallBoxes = products -10 return largeBoxes, "Large Boxes", smallBoxes, "Small Boxes" elif products < 5 and products > 0: smallBoxes = products return 0, "Large Boxes", smallBoxes, "Small Boxes" elif products <10 and products > 0: smallBoxes = products - 5 largeBoxes = 1 return largeBoxes, "Large Boxes", smallBoxes, "Small Boxes" return "Not enough boxes" print(Boxes.numberOfRequiredBoxes(2,2,10)) # 2 boxes hold 5 items # 10 boxes hold 1 item # What the minimum number of boxes required for N number of products where N is less than or equal to 20 and greater than 0
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question