Re: Probability Problem

2006-04-25 Thread Elliot Temple
309e-05 is 32 out of a million On Apr 24, 2006, at 9:14 PM, Alex Martelli wrote: > Elliot Temple <[EMAIL PROTECTED]> wrote: > >> On Apr 24, 2006, at 8:24 PM, Alex Martelli wrote: >> >>> Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: >>> &

Re: Probability Problem

2006-04-24 Thread Elliot Temple
On Apr 24, 2006, at 8:24 PM, Alex Martelli wrote: > Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > >> In article <[EMAIL PROTECTED]>, >> Elliot Temple <[EMAIL PROTECTED]> wrote: >> >>> Problem: Randomly generate 10 integers from 0-100

Probability Problem

2006-04-24 Thread Elliot Temple
nge101 = range(101) for x in xrange(9): print "x is %s" % x li2 = [] for y in li: for z in range101: li2 += [y+z] li = li2 print li.count(800) # prints how many ways the dice can add to 800 This link may help: http://www.math.csusb.edu/faculty/stanton/m2

Re: Scope

2005-06-03 Thread Elliot Temple
On Jun 4, 2005, at 2:13 AM, Leif K-Brooks wrote: > Elliot Temple wrote: > >> I want to write a function, foo, so the following works: >> >> def main(): >> n = 4 >> foo(n) >> print n >> >> #it prints 7 >> > > What&#x

Scope

2005-06-03 Thread Elliot Temple
n. n = 3 def main(): def foo(var, context, c2): exec var + " = 7" in context, c2 n = 4 foo("n", locals(), globals()) print n if __name__ == '__main__': main() print n And of course I tried: >>> def inc(n): ... n += 3 ...

Re: (OT) lincense protection generator

2005-06-02 Thread Elliot Temple
#x27;t want to check for anything hardware related because > then my program would fail to work once the people change their > hardware. > Anyway, it doesn't need to be waterproof. (not possible anyway) > > Any ideas? > > Regards, > Benedict > -- > htt

Re: Moving Places, Subtracting from slices/lists

2005-06-02 Thread Elliot Temple
adds indexes to a list. observe: hotcat = ['Cat', 'roof', 'on', 'a', 'hot', 'tin'] for index, word in enumerate(hotcat): if word == 'roof': del hotcat[index] you could also use a list comprehension hotcat = ['Cat', 'roof', 'on', 'a', 'hot', 'tin'] hotcat = [x for x in hotcat if x != 'roof'] -- Elliot Temple http://www.curi.us/ --- [This E-mail scanned for viruses by Declude Virus] -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginner question: Logs?

2005-06-01 Thread Elliot Temple
t? do either import math math.log10(15625) from math import * log10(15625) from math import log10 log10(15625) -- Elliot Temple http://www.curi.us/ --- [This E-mail scanned for viruses by Declude Virus] -- http://mail.python.org/mailman/listinfo/python-list

Pressing A Webpage Button

2005-06-01 Thread Elliot Temple
typing into a text field like the google search field before hitting the button? (I don't actually need to do this.) If someone could point me in the right direction it'd be appreciated. -- Elliot Temple http://www.curi.us/ --- [This E-mail scanned for viruses by Declude Virus]

Re: Case Sensitive, Multiline Comments

2005-05-29 Thread Elliot Temple
On May 29, 2005, at 11:44 AM, Arthur wrote: > On 26 May 2005 17:33:33 -0700, "Elliot Temple" <[EMAIL PROTECTED]> > wrote: > > >> Thanks for the link on case sensitivity. I'm curious about the >> person >> who found case sensitivity useful

Re: need help of RE

2005-05-29 Thread Elliot Temple
ng, how do you know where the words are? If it's whitespace that separates words, try out str.split() -- Elliot Temple http://www.curi.us/ --- [This E-mail scanned for viruses by Declude Virus] -- http://mail.python.org/mailman/listinfo/python-list

Re: need help of RE

2005-05-29 Thread Elliot Temple
oes it literally contain the characters '&' and '|' ? If so, just split at them. -- Elliot Temple http://www.curi.us/ --- [This E-mail scanned for viruses by Declude Virus] -- http://mail.python.org/mailman/listinfo/python-list

Re: String manipulations

2005-05-28 Thread Elliot Temple
d('.') decimal_places = len(s) - decimal_index - 1 Anything wrong with this? (it will mess up if there isn't a decimal but you can fix that if you want) -- Elliot Temple http://www.curi.us/ --- [This E-mail scanned for viruses by Declude Virus] -- http://mail.python.org/mailman/listinfo/python-list

Re: Get number of lines in file

2005-05-27 Thread Elliot Temple
lements in cpn_version. Could you use: count_lines = len(cpn_file.readlines()) -- Elliot Temple http://www.curi.us/ --- [This E-mail scanned for viruses by Declude Virus] -- http://mail.python.org/mailman/listinfo/python-list

Re: Case Sensitive, Multiline Comments

2005-05-27 Thread Elliot Temple
One other interesting thing about case sensitivity I don't think anyone has mentioned: in Python keywords are all lowercase already (the way I want to type them). In some other languages, they aren't... -- Elliot Temple http://www.curi.us/ --- [This E-mail scanned for viruses

Re: Strange Execution Times

2005-05-26 Thread Elliot Temple
e[end:]) else: out.write(line) t2 = time.clock() print round(t2-t1, 5) f.close() out.close() if __name__ == '__main__': main() -- Elliot Temple http://www.curi.us/ --- [This E-mail scanned for viruses by Declude Virus] -- http://mail.python.org/mailman/listinfo/python-list

Re: Case Sensitive, Multiline Comments

2005-05-26 Thread Elliot Temple
Thanks for the link on case sensitivity. I'm curious about the person who found case sensitivity useful though: what is it useful for? The way I find multi-line comments useful is to quickly comment out a block of code while debugging. A good development environment can (mostly) solve that one t

Re: Strange Execution Times

2005-05-26 Thread Elliot Temple
hey FYI i found the problem: i accidentally copied an output file for my test data. so all the passwords were exactly 32 chars long. so when replacing them with new 32 char passwords, it went much much faster, I guess because the list kept the same number of chars in it and didn't have to copy l

Case Sensitive, Multiline Comments

2005-05-26 Thread Elliot Temple
Hi I have two questions. Could someone explain to me why Python is case sensitive? I find that annoying. Also, why aren't there multiline comments? Would adding them cause a problem of some sort? Thanks, Elliot -- http://mail.python.org/mailman/listinfo/python-list