Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33579

Re: Problems on these two questions

Date 2012-11-19 20:52 -0500
From Dave Angel <d@davea.name>
Subject Re: Problems on these two questions
References <400c615f-4d93-4b8b-85ec-1bb4c47e30fe@googlegroups.com> <50A996EB.2000600@davea.name> <cdfla8ts287v7rdu4eo4n02imiqvacgp3t@invalid.netcom.com>
Newsgroups comp.lang.python
Message-ID <mailman.27.1353376363.29569.python-list@python.org> (permalink)

Show all headers | View raw


On 11/19/2012 06:16 PM, Dennis Lee Bieber wrote:
> On Sun, 18 Nov 2012 21:18:19 -0500, Dave Angel <d@davea.name> declaimed
> the following in gmane.comp.python.general:
>
>
>> if is_a_prime(n):
>>     is_prime = True
>>
>> Now all you have to do is write is_a_prime().  if you get stuck, please
>> show us what you've got, and what the problem is with it.  And as usual,
>> tell us what version of Python you're writing in, if any.
>>
> 	Since "is_a_prime" is returning a Boolean, this condenses to:
>
> 	is_prime = is_a_prime(n)

Nope, the original problem statement didn't say what should should
happen if n does have such factors.  Clearly, it's only describing a
program fragment.

"""1.Given a positive integer  n , assign True to  is_prime if  n has no factors other than  1 and itself. (Remember,  m is a factor of  n if  m divides  n evenly.) 

"""

-- 

DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Problems on these two questions su29090 <129km09@gmail.com> - 2012-11-18 17:52 -0800
  Re: Problems on these two questions Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-11-19 02:09 +0000
  Re: Problems on these two questions su29090 <129km09@gmail.com> - 2012-11-18 18:15 -0800
    Re: Problems on these two questions Dave Angel <d@davea.name> - 2012-11-18 21:33 -0500
  Re: Problems on these two questions Dave Angel <d@davea.name> - 2012-11-18 21:18 -0500
  Re: Problems on these two questions Chris Angelico <rosuav@gmail.com> - 2012-11-19 13:23 +1100
  Re: Problems on these two questions Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-19 18:15 -0500
    Re: Problems on these two questions Neil Cerutti <neilc@norwich.edu> - 2012-11-20 15:02 +0000
  Re: Problems on these two questions Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-19 18:16 -0500
  Re: Problems on these two questions Dave Angel <d@davea.name> - 2012-11-19 20:52 -0500
  Re: Problems on these two questions Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-19 23:32 -0700

csiph-web