Problems on these two questions

Dave Angel d at davea.name
Tue Nov 20 02:52:13 CET 2012


On 11/19/2012 06:16 PM, Dennis Lee Bieber wrote:
> On Sun, 18 Nov 2012 21:18:19 -0500, Dave Angel <d at 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



More information about the Python-list mailing list