Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #60018 > unrolled thread
| Started by | bradleybooth12345@gmail.com |
|---|---|
| First post | 2013-11-19 10:40 -0800 |
| Last post | 2013-11-20 09:29 +0000 |
| Articles | 17 on this page of 57 — 21 participants |
Back to article view | Back to comp.lang.python
Newbie - Trying to Help a Friend bradleybooth12345@gmail.com - 2013-11-19 10:40 -0800
Re: Newbie - Trying to Help a Friend maxwell34m@gmail.com - 2013-11-19 11:05 -0800
Re: Newbie - Trying to Help a Friend Neil Cerutti <mr.cerutti@gmail.com> - 2013-11-19 14:07 -0500
Re: Newbie - Trying to Help a Friend Gary Herron <gary.herron@islandtraining.com> - 2013-11-19 11:06 -0800
Re: Newbie - Trying to Help a Friend bradleybooth12345@gmail.com - 2013-11-19 11:27 -0800
Re: Newbie - Trying to Help a Friend Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-19 20:48 +0000
Re: Newbie - Trying to Help a Friend Duncan Booth <duncan.booth@invalid.invalid> - 2013-11-20 11:38 +0000
Re: Newbie - Trying to Help a Friend Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-23 02:03 +0000
Re: Newbie - Trying to Help a Friend Mark Janssen <dreamingforward@gmail.com> - 2013-11-19 14:51 -0800
Re: Newbie - Trying to Help a Friend Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-20 00:17 +0000
Re: Newbie - Trying to Help a Friend Dave Angel <davea@davea.name> - 2013-11-19 22:10 -0500
Re: Newbie - Trying to Help a Friend Steven D'Aprano <steve@pearwood.info> - 2013-11-20 03:52 +0000
Re: Newbie - Trying to Help a Friend Dave Angel <davea@davea.name> - 2013-11-20 00:54 -0500
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 09:29 +0000
Re: Newbie - Trying to Help a Friend Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-20 13:57 +0000
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 14:51 +0000
Re: Newbie - Trying to Help a Friend Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-20 18:33 -0500
Re: Newbie - Trying to Help a Friend Anssi Saari <as@sci.fi> - 2013-11-21 15:44 +0200
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 14:49 +0000
Re: Newbie - Trying to Help a Friend Chris Angelico <rosuav@gmail.com> - 2013-11-21 02:05 +1100
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 15:06 +0000
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 15:09 +0000
Re: Newbie - Trying to Help a Friend Chris Angelico <rosuav@gmail.com> - 2013-11-21 02:14 +1100
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 15:35 +0000
Multiple postings Alister <alister.ware@ntlworld.com> - 2013-11-20 15:36 +0000
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 15:34 +0000
Re: Newbie - Trying to Help a Friend Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-20 16:29 +0000
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 16:45 +0000
Re: Newbie - Trying to Help a Friend Ned Batchelder <ned@nedbatchelder.com> - 2013-11-20 09:12 -0800
Re: Newbie - Trying to Help a Friend Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-20 17:37 +0000
Re: Newbie - Trying to Help a Friend Ned Batchelder <ned@nedbatchelder.com> - 2013-11-20 09:51 -0800
Re: Newbie - Trying to Help a Friend Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-20 18:09 +0000
Re: Newbie - Trying to Help a Friend Ned Batchelder <ned@nedbatchelder.com> - 2013-11-20 10:18 -0800
Re: Newbie - Trying to Help a Friend Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-20 18:35 +0000
Re: Newbie - Trying to Help a Friend Ned Batchelder <ned@nedbatchelder.com> - 2013-11-20 11:54 -0800
Re: Newbie - Trying to Help a Friend Chris Angelico <rosuav@gmail.com> - 2013-11-21 07:26 +1100
Off-topic: Pop culture references [was Re: Newbie - Trying to Help a Friend] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-21 00:27 +0000
Re: Off-topic: Pop culture references [was Re: Newbie - Trying to Help a Friend] MRAB <python@mrabarnett.plus.com> - 2013-11-21 00:48 +0000
Re: Off-topic: Pop culture references [was Re: Newbie - Trying to Help a Friend] Tim Golden <mail@timgolden.me.uk> - 2013-11-21 09:08 +0000
Re: Off-topic: Pop culture references [was Re: Newbie - Trying to Help a Friend] Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-11-22 17:10 +1300
Re: Off-topic: Pop culture references [was Re: Newbie - Trying to Help a Friend] Chris Angelico <rosuav@gmail.com> - 2013-11-21 20:46 +1100
Re: Newbie - Trying to Help a Friend Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-11-21 12:53 +0100
Re: Newbie - Trying to Help a Friend Chris Angelico <rosuav@gmail.com> - 2013-11-22 02:48 +1100
Re: Newbie - Trying to Help a Friend Neil Cerutti <mr.cerutti@gmail.com> - 2013-11-21 11:29 -0500
Re: Newbie - Trying to Help a Friend Chris Angelico <rosuav@gmail.com> - 2013-11-22 04:10 +1100
Re: Newbie - Trying to Help a Friend bradleybooth12345@gmail.com - 2013-11-21 15:17 -0800
Re: Newbie - Trying to Help a Friend Gary Herron <gary.herron@islandtraining.com> - 2013-11-21 15:35 -0800
Re: Newbie - Trying to Help a Friend bradleybooth12345@gmail.com - 2013-11-21 15:55 -0800
Re: Newbie - Trying to Help a Friend Terry Reedy <tjreedy@udel.edu> - 2013-11-21 19:55 -0500
Re: Newbie - Trying to Help a Friend Gary Herron <gary.herron@islandtraining.com> - 2013-11-21 20:17 -0800
Re: Newbie - Trying to Help a Friend Terry Reedy <tjreedy@udel.edu> - 2013-11-21 19:17 -0500
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 15:34 +0000
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 15:06 +0000
Re: Newbie - Trying to Help a Friend Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-20 15:24 +0000
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 14:50 +0000
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 14:50 +0000
Re: Newbie - Trying to Help a Friend Alister <alister.ware@ntlworld.com> - 2013-11-20 09:29 +0000
Page 3 of 3 — ← Prev page 1 2 [3]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-11-21 20:46 +1100 |
| Subject | Re: Off-topic: Pop culture references [was Re: Newbie - Trying to Help a Friend] |
| Message-ID | <mailman.3006.1385027204.18130.python-list@python.org> |
| In reply to | #60146 |
On Thu, Nov 21, 2013 at 8:08 PM, Tim Golden <mail@timgolden.me.uk> wrote: > Of course, if some were to say "My name is Inigo Montoya; you killed my > father; prepare to die"... You killfiled my address - prepare to be ignored! ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
|---|---|
| Date | 2013-11-21 12:53 +0100 |
| Message-ID | <mailman.3009.1385048056.18130.python-list@python.org> |
| In reply to | #60118 |
Op 20-11-13 19:09, Mark Lawrence schreef: > On 20/11/2013 17:51, Ned Batchelder wrote: >> On Wednesday, November 20, 2013 12:37:31 PM UTC-5, Mark Lawrence wrote: >>> On 20/11/2013 17:12, Ned Batchelder wrote: >>>> >>>> Nazi? Perhaps we could stick to more appropriate analogies? >>>> >>>> --Ned. >>>> >>> >>> It's an excellent analogy that I've used before, hence the smiley. >>> Clearly you don't do any research before bothering to say anything. >>> >>> -- >>> Python is the second best programming language in the world. >>> But the best has yet to be invented. Christian Tismer >>> >>> Mark Lawrence >> >> You think these two things make an excellent analogy? 1) a newsgroup >> mishap being actively investigated, and 2) calculated genocide. It is >> not an excellent analogy, it's wildly disproportionate. >> >> Using a smiley doesn't fix it, and using it previously doesn't give >> you a free pass. What research was I supposed to have done? Examine >> your previous posts to see you overreacting before? That would hardly >> have convinced me that this was OK. >> >> --Ned. >> > > I suggest that you write to the BBC and get all episodes of the > extremely popular *COMEDY* "Dad's Army" withdrawn as "typical shabby > Nazi trick" was one of Captain Mainwearing's main lines. Honestly? You expect people to recognize a main line from an old television series? > And if I want > to overreact, I'll overreact, as I couldn't care two hoots whether I'm > dealing with an arsehole from the Python Software Foundation or one > who's not. Now you sound just like Nikos. -- Antoon Pardon
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-11-22 02:48 +1100 |
| Message-ID | <mailman.3010.1385050275.18130.python-list@python.org> |
| In reply to | #60118 |
On Thu, Nov 21, 2013 at 10:53 PM, Antoon Pardon <antoon.pardon@rece.vub.ac.be> wrote: > Op 20-11-13 19:09, Mark Lawrence schreef: >> I suggest that you write to the BBC and get all episodes of the >> extremely popular *COMEDY* "Dad's Army" withdrawn as "typical shabby >> Nazi trick" was one of Captain Mainwearing's main lines. > > Honestly? You expect people to recognize a main line from an old > television series? Well, a good British comedy does go around a long way. I have to say, though, the shortness of the line makes it harder to recognize. Only in the tightest of circles could one say "Bother that telephone!" and have people understand that it's a reference to the Fat Controller from The Railway Series (aka the Thomas the Tank Engine books). The more quote you make, the more likely that pieces of it will be recognized. But as I said, all it takes is a little footnote, or something like "... typical shabby Nazi trick, as Capt Mainwearing would say", to make it clear. Most (all?) of us would understand that as a joke/reference and as not offensive. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Neil Cerutti <mr.cerutti@gmail.com> |
|---|---|
| Date | 2013-11-21 11:29 -0500 |
| Message-ID | <mailman.3011.1385051374.18130.python-list@python.org> |
| In reply to | #60118 |
On Thu, Nov 21, 2013 at 10:48 AM, Chris Angelico <rosuav@gmail.com> wrote: > Well, a good British comedy does go around a long way. I have to say, > though, the shortness of the line makes it harder to recognize. Only > in the tightest of circles could one say "Bother that telephone!" and > have people understand that it's a reference to the Fat Controller > from The Railway Series (aka the Thomas the Tank Engine books). The > more quote you make, the more likely that pieces of it will be > recognized. The best sort of reference is one you can miss completely and still not be confused by. For example, The Borribles by De Larrabeiti is one of my favorite books despite my knowing virtually nothing of the back-streets of London or the (now dated) pop-culture satire it contained. Many of the main villains in the book are hilarious and mean-spirited parodies of a series of British children's literature, The Wombles, and a British TV show, Steptoe and Son, but the characters work fine on their own. But even so, I agree that a footnote is a good idea. And I haven't always lived up to that ideal, myself. -- Neil Cerutti <mr.cerutti+python@gmail.com>
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-11-22 04:10 +1100 |
| Message-ID | <mailman.3012.1385053851.18130.python-list@python.org> |
| In reply to | #60118 |
On Fri, Nov 22, 2013 at 3:29 AM, Neil Cerutti <mr.cerutti@gmail.com> wrote: > Many of the main villains in > the book are hilarious and mean-spirited parodies of > a series of British children's literature, The Wombles, > and a British TV show, Steptoe and Son, but the characters work > fine on their own. Yeah, that's definitely the best way to do it. You don't need to know The Beauty Stone to understand that Colinette, in the city of Lenalede, is trying to get herself appointed as Lord Chief Justice on the grounds that (she claims) the current incumbent is unfair in his rulings. But if you _do_ know that obscure 19th century opera, you'll know there's a line in it "And Colinette from Lenalede, who counts herself the fairest there". (The opera has absolutely nothing to do with justice, incidentally. Colinette is entering herself in a beauty contest. Quite a different meaning of "fairest".) ChrisA
[toc] | [prev] | [next] | [standalone]
| From | bradleybooth12345@gmail.com |
|---|---|
| Date | 2013-11-21 15:17 -0800 |
| Message-ID | <29330860-484d-4cc8-b01c-0460fb55c251@googlegroups.com> |
| In reply to | #60170 |
Coming back to the second question
"The collatz process is as follows. Take a positive integer n greater than 1. while n is greater than 1 repeat the following; if N is even halve it and if N is odd multiply it by 3 and add 1. The (Unsolved) collatz conjecture is that this process always terminates.
The user should be prompted to supply the number n, and your program should build the list of values taken by sucessive iteration of the algorithm, and print it out. For example, if 7 is input your program should print the list
[7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]
We've managed to come up with this, but obviously it's wrong. Any Idea's?
def collatz_sequence (n) :
seq = [ ]
if n < 1 :
return [ ]
while n > 1:
if n % 2 == 0:
n = n/2
else:
n = 3*n+ 1
seq.append (n)
return seq
[toc] | [prev] | [next] | [standalone]
| From | Gary Herron <gary.herron@islandtraining.com> |
|---|---|
| Date | 2013-11-21 15:35 -0800 |
| Message-ID | <mailman.3018.1385077304.18130.python-list@python.org> |
| In reply to | #60179 |
On 11/21/2013 03:17 PM, bradleybooth12345@gmail.com wrote: > Coming back to the second question > > "The collatz process is as follows. Take a positive integer n greater than 1. while n is greater than 1 repeat the following; if N is even halve it and if N is odd multiply it by 3 and add 1. The (Unsolved) collatz conjecture is that this process always terminates. > > The user should be prompted to supply the number n, and your program should build the list of values taken by sucessive iteration of the algorithm, and print it out. For example, if 7 is input your program should print the list > > [7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1] > > We've managed to come up with this, but obviously it's wrong. Any Idea's? > > def collatz_sequence (n) : > seq = [ ] > if n < 1 : > return [ ] > while n > 1: > if n % 2 == 0: > n = n/2 > else: > n = 3*n+ 1 > seq.append (n) > return seq Why do you say it's wrong? What does it do? What was expected? I see that your indentations don't match, but I can't tell if that's your error or an email problem. Is that the 'obviously wrong' part? I also see that you create an (apparently correct) function, which returns a nice result. But you haven't called the function to actually run it with a specific value to be printed out. Perhaps that's the 'obviously wrong' part you refer to. However, the function itself looks correct otherwise, although you may want to start the sequence off with [n] rather than [] so as to match the suggested output. Gary Herron
[toc] | [prev] | [next] | [standalone]
| From | bradleybooth12345@gmail.com |
|---|---|
| Date | 2013-11-21 15:55 -0800 |
| Message-ID | <ca6c2187-d6ab-499b-8d0e-e31e7b36ab62@googlegroups.com> |
| In reply to | #60180 |
the problem i have is that it's just giving me the first number of the sequence not the actual sequence
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2013-11-21 19:55 -0500 |
| Message-ID | <mailman.3022.1385081765.18130.python-list@python.org> |
| In reply to | #60181 |
On 11/21/2013 6:55 PM, bradleybooth12345@gmail.com wrote: > the problem i have is that it's just giving me the first number of the sequence not the actual sequence Please show actually copy/pasted input and output. -- Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | Gary Herron <gary.herron@islandtraining.com> |
|---|---|
| Date | 2013-11-21 20:17 -0800 |
| Message-ID | <mailman.3026.1385094400.18130.python-list@python.org> |
| In reply to | #60181 |
On 11/21/2013 03:55 PM, bradleybooth12345@gmail.com wrote: > the problem i have is that it's just giving me the first number of the sequence not the actual sequence Not when I run it. After correcting the indentation errors, I get the correct sequence *except* that it's missing the first number. You are making it very hard to help you. Please show us the *whole* session: the procedure (correctly indented please), the call of the procedure, the print that outputs the result and the actual printed result. Also provide an explanation of why the output is not what you wanted. Then perhaps we can get to the bottom of this. Gary Herron
[toc] | [prev] | [next] | [standalone]
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2013-11-21 19:17 -0500 |
| Message-ID | <mailman.3020.1385079448.18130.python-list@python.org> |
| In reply to | #60179 |
On 11/21/2013 6:17 PM, bradleybooth12345@gmail.com wrote:
>
> Coming back to the second question
>
> "The collatz process is as follows. Take a positive integer n greater than 1. while n is greater than 1 repeat the following; if N is even halve it and if N is odd multiply it by 3 and add 1. The (Unsolved) collatz conjecture is that this process always terminates.
> The user should be prompted to supply the number n, and your program should build the list of values taken by sucessive iteration of the algorithm, and print it out. For example, if 7 is input your program should print the list
>
> [7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]
The specification does not say what the result should be when the input
is 1, but given the example above, [1] seems reasonable (rather than an
exception or []). [] is ok for 0 (or negative).
> We've managed to come up with this, but obviously it's wrong.
In what way is it wrong? The answer to that tells you what to fix.
A syntax error about indentation? Fix the indentation.
> Any Idea's?
Write test code before writing the function.
for inn,out in [(0, []), (1, [1]), (2, [2,1]),
(3, [3,10,5,16,8,4,2,1]),
(7, [7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1]), ]:
s = collatz(inn)
print(inn, ':', s)
if s != out:
print('is not', out)
> def collatz_sequence (n) :
> seq = [ ]
4 space indents are best; a good editor, like the one with Idle, will
convert <tab> to 4 spaces
> if n < 1 :
> return [ ]
> while n > 1:
> if n % 2 == 0:
dedent if so it lines up with else below
> n = n/2
> else:
> n = 3*n+ 1
> seq.append (n)
> return seq
does not line up with while
Once you get indents consistent, test failure should suggest the
remaining error.
--
Terry Jan Reedy
[toc] | [prev] | [next] | [standalone]
| From | Alister <alister.ware@ntlworld.com> |
|---|---|
| Date | 2013-11-20 15:34 +0000 |
| Message-ID | <oE4ju.43659$Gy4.20164@fx11.am4> |
| In reply to | #60094 |
On Thu, 21 Nov 2013 02:14:12 +1100, Chris Angelico wrote: > On Thu, Nov 21, 2013 at 2:09 AM, Alister <alister.ware@ntlworld.com> > wrote: >> must be a strange quirk of pan & turned off hide to system tray & allow >> multiple instances. > > Hmm. Hard to know, but I can imagine that having multiple instances > MIGHT cause a problem. But if that's confirmed (maybe fire up three > copies and then post to a test newsgroup??), I'd be reporting that as a > bug in Pan. > > ChrisA As a quick test lets see how may times this one arrives -- You can fool all the people all of the time if the advertising is right and the budget is big enough. -- Joseph E. Levine
[toc] | [prev] | [next] | [standalone]
| From | Alister <alister.ware@ntlworld.com> |
|---|---|
| Date | 2013-11-20 15:06 +0000 |
| Message-ID | <Ed4ju.115243$qC.92401@fx07.am4> |
| In reply to | #60086 |
On Wed, 20 Nov 2013 14:49:59 +0000, Alister wrote: > 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@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) Ok this is now silly Apologies to everyone I am monitoring my network connection to confirm that i am not sending multiple times. -- T-1's congested due to porn traffic to the news server.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2013-11-20 15:24 +0000 |
| Message-ID | <mailman.2969.1384961068.18130.python-list@python.org> |
| In reply to | #60093 |
On 20/11/2013 15:06, Alister wrote: > > Ok this is now silly > Apologies to everyone I am monitoring my network connection to confirm > that i am not sending multiple times. > Still arriving multiple times, shoot the messenger? :) -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Alister <alister.ware@ntlworld.com> |
|---|---|
| Date | 2013-11-20 14:50 +0000 |
| Message-ID | <V_3ju.169173$v41.121818@fx23.am4> |
| In reply to | #60076 |
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@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
[toc] | [prev] | [next] | [standalone]
| From | Alister <alister.ware@ntlworld.com> |
|---|---|
| Date | 2013-11-20 14:50 +0000 |
| Message-ID | <n%3ju.115242$qC.85556@fx07.am4> |
| In reply to | #60076 |
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@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
[toc] | [prev] | [next] | [standalone]
| From | Alister <alister.ware@ntlworld.com> |
|---|---|
| Date | 2013-11-20 09:29 +0000 |
| Message-ID | <Hh%iu.46262$5S.29955@fx29.am4> |
| In reply to | #60054 |
On Wed, 20 Nov 2013 00:54:28 -0500, Dave Angel wrote:
> On 20 Nov 2013 03:52:10 GMT, Steven D'Aprano <steve@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.
--
I am practicing a fine point of ethics. It is acceptable to shoot back.
It is not acceptable to shoot first.
-- Zed Pobre
[toc] | [prev] | [standalone]
Page 3 of 3 — ← Prev page 1 2 [3]
Back to top | Article view | comp.lang.python
csiph-web