Newbie - Trying to Help a Friend

Alister alister.ware at ntlworld.com
Wed Nov 20 15:50:29 CET 2013


On Wed, 20 Nov 2013 13:57:30 +0000, Mark Lawrence wrote:

> On 20/11/2013 09:29, Alister wrote:
>> On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote:
>>
>>> On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano <steve at pearwood.info>
>>> wrote:
>>>> 2 does count because it isn't divisible by 3. The question states,
>>>> "[count] how many positive integers less than N are not divisible
>>> by 2,3
>>>> or 5". Two is not divisible by 3, so "not divisible by 2,3 or 5" is
>>> true,
>>>> so two gets counted.
>>>
>>>> The first number which is divisible by *all* of 2, 3 and 5 (i.e.
>>> fails
>>>> the test, and therefore doesn't get counted) is 30. The next few
>>> that
>>>> fail the test are 60, 90, 120, 150, 180, 210, 240, 270, 300, ...
>>>> Remember, these are the numbers which should not be counted.
>>>
>>>>> I count 1, not 6
>>>
>>>> Out of curiosity, which number did you count?
>>>
>>> 1 of course. It's the only one that's not divisible by any of the
>>> factors.
>>>
>>> Apparently we disagree about precedence and associativity in English.
>>> I believe the not applies to the result of (divisible by 2, 3, or 5),
>>> so I'd count 1, 7, 11, 13, 17, 19, 23. The first nonprime would be 49.
>>>
>>> If I were trying to get the series you describe, I'd phrase it as
>>>    "Not divisible by 2, and not divisible by 3, and not divisible by
>>>    5"
>>
>> This ambiguity is a great example of why teachers (and enayone else
>> responsible for specifying a programming project) should take greater
>> care when specifying tasks.
>> if it is to late to ask for clarification (the correct step in a real
>> world case) I suggest you write 2 programs 1 for each interpretation,
>> it will be good for your personal learning even if the teacher does not
>> give any extra credit.
>>
>>
> Ambiguity is the reason that some of the most expensive language lessons
> in the world are at places like Sandhurst and West Point.  Giving
> crystal clear orders, whether verbally or in writing, is considered
> quite important in the military.
> 
> By the way, this is double posted and there were four identical messages
> from you yesterday, finger trouble or what? :)

I don't think the problem is at my end. I am only sending once to the 
best of my knowledge
(using Pan newsreader to Comp.lang.python)




-- 
Thou shalt not put policy into the kernel.

	- Al Viro on linux-kernel



More information about the Python-list mailing list