>Michael has already explained that this is building >a tuple of tuples. But you want to create strings. >So first convert r to a string using str(r)
Yeah sorry about that....read some java over the weekend (source code to http://reprap.org)...and then munged some of its syntactic sugar into the python area of my brain. Python does not support that operation for + --Michael -- Michael Langford Phone: 404-386-0495 Consulting: http://www.TierOneDesign.com/ On 10/15/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > <[EMAIL PROTECTED]> wrote > > > print "" > > print "--------------------" > > print "Unsigned Binary" > > print "--------------------" > > print "" > > You don;t need the empty quotes to print a newline. > > In fact the whole of the above is easier done using triple quotes > > print """ > -------------------- > Unsigned Binary > -------------------- > """ > > It has nothing to do with your problem but for future reference... > > To the real issue: > > > n = int(raw_input("Please enter an integer: ")) > > b = '' > > so n is an integer and b is a string. > > > while n > 0: > > r = n%2 > > n = n/2 > > b = r,b > > Michael has already explained that this is building > a tuple of tuples. But you want to create strings. > So first convert r to a string using str(r) > Now you can append using the plus operation for strings > > b = r+b > > or just > > b += r > > HTH, > > -- > Alan Gauld > Author of the Learn to Program web site > http://www.freenetpages.co.uk/hp/alan.gauld > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor