Weight Problem

Gary Herron gherron at islandtraining.com
Sun Mar 16 16:32:47 CET 2008

Ravi Kumar wrote:
> An Interesting problem,
> """
> A man has only 4 bricks of different weights, lies between 1-40KG,
> Also, the total weights of Brick A, B, C, D (ie A+B+C+D) is 40KG.
> The man uses that brick to calculate every possible weight
> from 1 KG to 40 KG in  his shop. (only whole numbers 1KG, 2KG etc, not 
> like 2.3KG)
> """
> I thought it would really be good to solve it by python, and right now 
> on the mid-way solving using very dirty approach.
> But I feel, using SETs with python in such would solve it better.
> Can anyone come with good solution, and maybe solution showing usage 
> of Sets.
> -- 
> -=Ravi=- 

This sounds like a homework problem,  something you should be solving 
yourself.  If, however, you have any Python questions, then please ask. 
  We'll be glad to answer them.

Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418

More information about the Python-list mailing list