frustrated stupid newbie question

Scott Kurland skurland at juggler.net
Tue Mar 12 18:59:54 EST 2002


> > Why isn't this $%^*#$% program working?
>
> > #Searching for perfect numbers
> >
> > howhigh= input ("How high should I check?")
> > for number in range (1,howhigh):
> >  factorsum = 0
> >  halfnumber=number/2
> >  for checking in range (1,halfnumber):
> >   if number/checking == int (number/checking):
> >    factorsum = factorsum + checking
> >  if number == factorsum:
> >   print number
> >
>
> What do you mean it isn't working? It ran without crashing when I tried
it.
> Here is the output from a sample run:
>
> >>>
> How high should I check?50
> 10
>
> Are you expecting some other type of output? What are you expecting?

Well, I was expecting failure, which we got.  What I hoped for was the two
perfect numbers between 1 and 50, 6 and 28.
>
>
> > Flame away, I can't feel dumber than this.
>
> Oh, now what newsgroup mistreated you so, that you would expect such a
> thing? We don't do that here in comp.lang.python!
>
> --
> Sheila King
> http://www.thinkspot.net/sheila/
> http://www.k12groups.org/

Goodness! I'll have to mind my manners carefully, then; usenet has roughened
them some.

Thank you, Sheila.


Scott





More information about the Python-list mailing list