Liam,
Just looking at this -
i = 456
s = ''
while i:
s = str(i % 2) + s
i/=2
This works, far simpler than mine, which is always infuriating, but
my
question is, how exactly?
This is the classic math treatment of how to calculate a binary
number.
Just keep dividing by two and
Ah, yeah, gotta get me one of those textbooks.
(Wait a minute, that would mean, my approach wasn't the textbook
approach... /me salvages a little pride.)
While I jest somewhat, that highlights a serious deficiency in my
education that becomes more and more apparent, which is in maths.
Sheesh, if
Even more OT it would seem, but harking back to the original subject,
Perl isn't looking too bad because I've been working through Java
tonight.
$j = STDIN; is relatively intuitive for a child of Unix, and it's
also documented.
BufferedReader keyboard = new BufferedReader(new
On Feb 6, 2005, at 08:59, Liam Clarke wrote:
Ah, yeah, gotta get me one of those textbooks.
(Wait a minute, that would mean, my approach wasn't the textbook
approach... /me salvages a little pride.)
While I jest somewhat, that highlights a serious deficiency in my
education that becomes more and
Liam Clarke wrote:
4 is 001 (on a continuum of 2^0 to 2^n), but using the above approach
we get 100.
?? 4 (decimal) is 100 (binary). Not because of how the conversion algorithm works, but because that
is how we write numbers. The least-significant digit is always the rightmost digit. 001 is 1 in
On 6 Feb 2005, [EMAIL PROTECTED] wrote:
Actually, generating the digits from the right complicates the algorithm quite
a bit. It's hidden in
the Python version, but s = str(i % 2) + s is a relatively expensive
operation here - it has to copy
all of s to make room for the new digit.
While I jest somewhat, that highlights a serious deficiency in my
education that becomes more and more apparent, which is in maths.
Yes, its a sad fact. Good programming beyond basics does require a
modicum of maths. You can learnn enough to do useful things without
math, but there reaches a
Title: Percolation model in python
Hello,
I have been working with some high school students to create a model of small pox transmission.
I am somewhat new to python (my programming experience is in f77) so I have borrowed parts of Danny's code that he posted for the Game of Life. I have
Ah, thanks all. I wasn't thinking of base 2 numbers like base 10 -
when you describe it like that, I get i. (100 = 10^2 + 0*10^1 +
0*10^0) I was thinking strictly in terms of a base 10 number described
by flags for each power of 2, which (to me) would logically start from
2^0 and go right.
And
Jacob S. wrote:
aFuncList=[]
def x():
print one
aFuncList.append(x)
def x():
print two
aFuncList.append(x)
def x():
print three
aFuncList.append(x)
for item in aFuncList:
item()
Okay, for this problem (it can be altered otherwise)
def makefunct(stri):
def x():
As I understand, .get() has to get an index argument to get the text
from the Text index...
Thats true.
The problem is that I dont realy understand what is this index thing
Thats not surprising the Text widget index in Tk (its not really a
Tkinter thing, its part of the underlying Tk
I want to read the httpd-access.log and remove any oversized log records
I quickly tossed this script together. I manually mv-ed log to log.bak
and touched a new logfile.
running the following with print i uncommented does print each line to
stdout. but it doesn't write to the appropriate
12 matches
Mail list logo