Body Weight Converter
<p>I'm using TDD to build a Python function that takes in a string of separated, ascending bodyweights, for example <code>"103 123 4444 99 2000"</code>, and outputs the same numbers in the same string format BUT in ascending order according to their individual sums. Thus, the above input should have a result of <code>"2000 103 123 4444 99"</code>. </p>

<p>I've managed to break the parts down to what is needed to decipher the correct order based on input, however I'm unsure how to reorder the inputs based on the individual sums I've managed to calculate. </p>

<p>You'll notice on line 5 I'm using the wrong integers, as these are the sums, not the original inputs. This was just my attempt to visualize how to convert the list back to a string with single spaces. </p>

<pre><code>def ordered_weight(strng):
    str_split = strng.split()
    int_split = list(map(int, str_split))
    sum_lst = sorted([sum(map(int, str(i))) for i in str_split])
    return ' '.join(str(x) for x in sum_lst)
</code></pre>

<p>One additional parameter a colleague presented:</p>

<blockquote>
  <p>When two numbers have the same "weight", let us class them as if they were strings and not numbers: 100 is before 180 because its "weight" (1) is less than the one of 180 (9) and 180 is before 90 since, having the same "weight" (9) it comes before as a string.</p>
</blockquote>

<p>Please help! Thank you!
MJ</p>