You know, Alan, I remember you commenting that you had some flakey behavior from this list a few of weeks ago, then over the weekend I received about two dozen emails from threads as far back as August.
Something is definitely wonky (technical term ;-) about this list server. Alan Gauld wrote: > <[EMAIL PROTECTED]> wrote > > >> I'm trying to get this binary converter working, but I can't seem to >> get the >> negatives to work properly. >> > > I already sent a reply on this, but: > > >> def conversion(n): >> b = '' >> while n > 0: >> > > This line means you only ever return an empty string for a negative > n... > > >> n = int(raw_input("Please enter a signed integer: ")) >> bits = int(raw_input("Please enter the number of bits: ")) >> count = conversion(n).count("0") + conversion(n).count("1") >> > > And you call it with anegative n here and use the empty > string to calculate the count... => 0. > > HTH, > > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor