How to rearrange array using Python?

Martin Schöön martin.schoon at gmail.com
Fri Jul 31 22:53:45 CEST 2015


Den 2015-07-31 skrev Robin Koch <robin.koch at t-online.de>:
> Am 30.07.2015 um 22:31 schrieb Martin Schöön:
>
>> Scores to the right show how many wishes are fulfilled in each room
>
> Is it possible the is a mistake in the sum column on the third row?
> Should the be a 1?

Indeed.
>
>> The goal is to re-shuffle the array to maximize this score.
>>
>> How do I go about doing that?
>
> Depending on how you store those wishes I'd think you can use
> random.shuffle()!?

When cruising the net yesterday I came across this and it looked to me
it does re-shuffle arrays but not in a way that helps me. Maybe I
am wrong.
>
> But do you think simply maximising the score is the optimal solution to 
> the problem?

It is a start. The result will no doubt need some human post-processing.
I am merely hoping to eliminate the grunt-work.

(There will be pre-processing too, correcting misspelled names etc...)

> That way some kids will get their both wishes fulfilled (s, e and p in 
<snip>
> kids picking each other. Another thing one might want to takeinto 
> account. :-))
>
I did hint at differences between my example and the real problem...

/Martin


More information about the Python-list mailing list