On Aug 12, 4:33 am, Paul Rubin wrote:
> Baba writes:
> > exercise: given that packs of McNuggets can only be bought in 6, 9 or
> > 20 packs, write an exhaustive search to find the largest number of
> > McNuggets that cannot be bought in exact quantity.
>
> Is that a homework problem? Hint: first
On 08/13/2010 10:57 AM, Martin P. Hellwig wrote:
> SPOILER ALTER: THIS POST CONTAINS A POSSIBLE SOLUTION
>
> On 08/12/10 21:41, News123 wrote:
>
>> On 08/12/2010 09:56 PM, Martin P. Hellwig wrote:
>>> On 08/11/10 21:14, Baba wrote:
>>>
>>>
>>> How about rephrasing that question in your mind firs
Martin P. Hellwig wrote:
On 08/13/10 10:46, Peter Otten wrote:
Martin P. Hellwig wrote:
SPOILER ALTER: THIS POST CONTAINS A POSSIBLE SOLUTION
No it wasn't :-)
which should be 1*9 + 2*6
What am I missing?
Aah interesting, 21 % 9 returns 3 instead of 12, which makes sense of
course. I gu
On 08/13/10 10:46, Peter Otten wrote:
Martin P. Hellwig wrote:
SPOILER ALTER: THIS POST CONTAINS A POSSIBLE SOLUTION
No it wasn't :-)
which should be 1*9 + 2*6
What am I missing?
Aah interesting, 21 % 9 returns 3 instead of 12, which makes sense of
course. I guess the algorithm has to b
SPOILER ALTER: THIS POST CONTAINS A POSSIBLE SOLUTION
On 08/12/10 21:41, News123 wrote:
On 08/12/2010 09:56 PM, Martin P. Hellwig wrote:
On 08/11/10 21:14, Baba wrote:
How about rephrasing that question in your mind first, i.e.:
For every number that is one higher then the previous one*:
On 08/12/2010 09:56 PM, Martin P. Hellwig wrote:
> On 08/11/10 21:14, Baba wrote:
>
>
> How about rephrasing that question in your mind first, i.e.:
>
> For every number that is one higher then the previous one*:
> If this number is dividable by:
> 6 or 9 or 20 or any combination of
On 08/11/10 21:14, Baba wrote:
How about rephrasing that question in your mind first, i.e.:
For every number that is one higher then the previous one*:
If this number is dividable by:
6 or 9 or 20 or any combination of 6, 9, 20
than this number _can_ be bought in an exac
Baba wrote:
Hi News123
Thank You for helping me out. Indeed i am not looking for the code but
rather for hints that direct my reasoning as well as hints as to how
to write basic programs like this.
You have broken down the approach into 2 parts. I have tried to solve
part 1 but i'm not quite th
Baba wrote:
> def can_buy(n_nuggets):
[snip]
> can_buy(55)
>
> as you can see i am trying to loop through all combinations of values
> bewtween 1 and n_nuggets and when the equation resolves it should
> return True, else it should return False.
>
> I was hoping that when i then call my function and
Hi News123
Thank You for helping me out. Indeed i am not looking for the code but
rather for hints that direct my reasoning as well as hints as to how
to write basic programs like this.
You have broken down the approach into 2 parts. I have tried to solve
part 1 but i'm not quite there yet. Here'
On 08/11/2010 10:14 PM, Baba wrote:
> level: beginner
>
> exercise: given that packs of McNuggets can only be bought in 6, 9 or
> 20 packs, write an exhaustive search to find the largest number of
> McNuggets that cannot be bought in exact quantity.
>
> exercise source:
> http://ocw.mit.edu/cours
Steven D'Aprano wrote:
On Wed, 11 Aug 2010 13:14:35 -0700, Baba wrote:
level: beginner
exercise: given that packs of McNuggets can only be bought in 6, 9 or 20
packs, write an exhaustive search to find the largest number of
McNuggets that cannot be bought in exact quantity.
Is this a trick q
Hi Steven,
On 08/12/2010 01:37 AM, Steven D'Aprano wrote:
> On Wed, 11 Aug 2010 13:14:35 -0700, Baba wrote:
>
>> level: beginner
>>
>> exercise: given that packs of McNuggets can only be bought in 6, 9 or 20
>> packs, write an exhaustive search to find the largest number of
>> McNuggets that cann
On Wed, 11 Aug 2010 13:14:35 -0700, Baba wrote:
> level: beginner
>
> exercise: given that packs of McNuggets can only be bought in 6, 9 or 20
> packs, write an exhaustive search to find the largest number of
> McNuggets that cannot be bought in exact quantity.
Is this a trick question?
I'd lik
As said in the instructions.
if you find six consecutive numbers, that can be bough in exact
quantity, then you know, that all bigger numbers can also be bought in
exact quantity.
I would do a brute force approach
first I would create one function, which will try to find out, whether
one can
15 matches
Mail list logo