On Mon, 31 Oct 2005, Kent Johnson wrote:
> Norman Silverstone wrote:
> > I am a beginner so, I hope what I give, makes sense. In it's simplest
> > form what is wrong with :-
> >
> > n = input("Enter a number")
> > if n % 2 != 0 and n % 3 != 0:
> >print n, " Is a prime number"
> >
> This only
> n = input("Enter a number")
> if n % 2 != 0 and n % 3 != 0:
> print n, " Is a prime number"
>
> Comments please.
According to this 25 is a prime number
Alan G.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tut
> > Thank you for your comment which, if I understand you correctly, implies
> > that prime numbers greater than 25 will not be recognised. Surely, that
> > cannot be correct. However, if it is correct, could you please
> > demonstrate what you mean for my education.
>
> More precisely, it will g
Norman Silverstone wrote:
> On Mon, 2005-10-31 at 06:12 -0500, Kent Johnson wrote:
>
>>Norman Silverstone wrote:
>>
>>>I am a beginner so, I hope what I give, makes sense. In it's simplest
>>>form what is wrong with :-
>>>
>>>n = input("Enter a number")
>>>if n % 2 != 0 and n % 3 != 0:
>>> print
From: "Norman Silverstone" <[EMAIL PROTECTED]>
> On Mon, 2005-10-31 at 06:12 -0500, Kent Johnson wrote:
>> Norman Silverstone wrote:
>> > I am a beginner so, I hope what I give, makes sense. In it's simplest
>> > form what is wrong with :-
>> >
>> > n = input("Enter a number")
>> > if n % 2 != 0 an
On Mon, 2005-10-31 at 06:12 -0500, Kent Johnson wrote:
> Norman Silverstone wrote:
> > I am a beginner so, I hope what I give, makes sense. In it's simplest
> > form what is wrong with :-
> >
> > n = input("Enter a number")
> > if n % 2 != 0 and n % 3 != 0:
> >print n, " Is a prime number"
> >
Norman Silverstone wrote:
> I am a beginner so, I hope what I give, makes sense. In it's simplest
> form what is wrong with :-
>
> n = input("Enter a number")
> if n % 2 != 0 and n % 3 != 0:
>print n, " Is a prime number"
>
This only gives the correct answer if n < 25. You can't test against
> I am trying to write a program that will figure out if a number is prime
> or not. Currently this is the code that I have:
>
> import math
>
> def main():
>
> number=input("Please enter a positive whole number greater than 2: ")
> for value in range(2, number-math.sqrt):
> if
> 1. What is 'exit'?
instead of exit I can use break so that the loop will stop executing> 2. What is 'number -
math.sqrt'?for math.sqrt I could use math.sqrt(n) so that it would take the sqrt of nwhich is entered in by the userHowever for the output I am still receivingenter a numbe
>
>
>> I am trying to write a program that will figure out if a number is prime
>> or not. Currently this is the code that I have:
>
> [code cut]
>
> Hi Andrade1,
>
> As in your other previous homework programs, you seem to have some trouble
> with control flow. Have you considered talking with yo
> I am trying to write a program that will figure out if a number is prime
> or not. Currently this is the code that I have:
[code cut]
Hi Andrade1,
As in your other previous homework programs, you seem to have some trouble
with control flow. Have you considered talking with your professor or
Hello
I am trying to write a program that will figure out if a number is prime
or not. Currently this is the code that I have:
import math
def main():
number=input("Please enter a positive whole number greater than 2: ")
for value in range(2, number-math.sqrt):
if number % value
12 matches
Mail list logo