[Tutor] Negative Signed Binary Conversion

2007-10-22 Thread ddm2
Hi, I'm trying to get this binary converter working, but I can't seem to get the negatives to work properly. If the integer is too low, the 0's that are added for the amount of bits gets out of whack. I've tried to solve the problem by adding another 'count' meter by which I can then tell if there

Re: [Tutor] String module; Count

2007-10-21 Thread ddm2
Hi, Not sure if this is necessary, as I sent another email to the list (I think), but since I'm new to this thing, I thought I'd do the safe thing and try a second time. The code almost works now. Although, as soon as the converter gets a number -8 or lower, it adds a 0 that is not necessary. CO

[Tutor] String module; Count

2007-10-17 Thread ddm2
I am having trouble getting the string.count function to work. I want it to count the amount of digits (0 or 1) in the string, but I keep getting an error stating the string.count was expecting a character buffer object. CODE: count = string.count(conversion(n),["0","1"]) ERROR: Traceback (most re

[Tutor] Decimal Conversion

2007-10-15 Thread ddm2
Hi, I'm new to Python, and found some problems on the internet that would be a good start to begin. The problem I have is that my conversion program (which currently only converts unsigned integers) also prints all these brackets and commas. Here is my code and the result: CODE: print "" print "--