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:
>>>
&
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
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
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
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
...
#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
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
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
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]
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
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
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
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
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
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
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
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
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
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
19 matches
Mail list logo