count += n/3
> count % n == 1
> return n
What's b? It is never used.
Every time through the loop, you start the count at zero again.
This function will always return y, the stopping value.
--
Steven D'Aprano
ackwards, so you are only
ever deleting words you've already seen:
for i in range(len(candidates)-1, -1, -1)):
word = candidates[i]
if some_test():
del candidates[i]
I know the series of -1, -1, -1 is ugly, but that's what it takes.
--
Steven D'Aprano
___
00) if x <= 5]
There's no way to break out of the list comp early -- it has to keep
going past 5 all the way to the end.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
#x27;ve never heard of "Head First Programming" -- how are they
unconventional?
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ingispolite.com/likepython/
#!usr/bin/python
# My first Like, Python script!
yo just print like "hello world" bro
I can't wait to put that on my resume :)
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Wed, 29 Sep 2010 01:41:22 am Peter Otten wrote:
> You should never iterate over a list or dictionary and add or remove
> items to it at the same time. That is a recipe for disaster even if
> it doesn't fail explicitly*
[...]
> (*) I'll leave it to Steven D'A
But it might do
the job you want.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
cally adds a newline after the string, so each
printed string should be on its own line. But later, when you write the
string to the file, you must add the newline yourself.
> l=()
> l=(strip(k[2]))
> a.write(l)
There's no need to clear l with the line l=() first. Just write
g =" part? Thanks.
>
> 1. string is a module which is deprecated. You should probably use
> str or s in your example.
Actually, in this case Corey is not using the string module, but is
using string as the name of a variable.
--
Steven D'Aprano
___
ere is, I have to
> grab the value at that slot. If not I have to print something else.
> When I tried "in" in the interpreter, I got something about builtin
> function not being iterable. TIA for any suggestions.
Without knowing exactly what you wrote, and what error you go
o, it is a little-known thing that Windows accepts forward slashes as
well as back-slashes in pathnames. So it is easier to write:
"C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr.exe"
than:
"C:\\Archivos de programa\\FWTools2.4.7\\bin\\ogr2ogr.exe"
--
Steven D'
Thank you.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
but I can be more specific
once you've answered the above two questions.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ut
what the greatest number you need to test would be.
* If a number isn't divisible by 2, then it can't possibly be
divisible by 4, 6, 8, 10, ... either. So apart from 2, there's
no need to check even numbers.
--
Steven D'Aprano
___
= string.split('\n')
Much faster, simpler, and does the job. To get rid of empty lines:
list_of_lines = filter(None, string.split('\n'))
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscrip
am to deal with the file a piece at a time.
(This is often a good strategy for small files as well, but it is
essential for huge ones.)
Of course, "small" and "huge" is relative to the technology of the day.
I remember when 1MB was huge. These days, huge would mean gigabytes.
ad to read my
> arguments and passed them to the os.system(), it worked. Now when I
> execute this command, in my normal DOS Windows, I must change to
> another path before I run the .exe, I don't know how to tell this to
> my python module.
os.chrdir(path)
cha
self.data = data
self.next = next
mylist = Node("a")
mylist.next = Node("b", Node("c"))
node = mylist
while node is not None:
print node.data
node = node.next
--
Steven D'Aprano
___
Tutor mail
On Thu, 30 Sep 2010 11:52:49 pm Emmanuel Ruellan wrote:
> On Thu, Sep 30, 2010 at 1:57 PM, wrote:
> > 1 is prime
>
> One is /not/ prime.
There's no need to apologize for pedantry. Saying that one is prime is
like saying that 2 is an odd number, or that glass is a type of
g else, just getting one of its properties.
> I was wondering how to make it fire off set to for certain methods.
You can't.
What problem are you trying to solve? There is likely another way to
solve it. (Not necessarily an easy way, but we'll see.)
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
set method if the old form and the new form are unequal,
> there is no easy way?
I repeat... what problem are you trying to solve?
Calling the set method for something that *doesn't* set a property
doesn't sound like a solution to a problem to me. It sounds li
ned:
>>> mo = re.search(r'(\d+)\s+\D*(\d+)\s+(\d)', 'spam42 eggs239')
>>> mo.groups()
('42', '23', '9')
Don't forget that mo will be None if the regex doesn't match, and don't
forget that the items returned
He goes on to admit that his regex wrongly rejects .museum addresses,
but he considers that acceptable. He seriously suggests that it would
be a good idea for your program to list all the TLDs, and even all the
country codes, even though "by the time you
y regexp would match anything
> at all.
Square brackets create a character set, so your regex tests for a string
that contains a single character matching a digit (\d), a plus sign (+)
or a whitespace character (\s). The additional \d + \s in the square
ction:
def add_word(genre, word, count):
genre = genre.title()
word = word.lower()
count = int(count)
# Add word to the genres table.
row = genres.setdefault(genre, {})
row[word] = row.get(word, 0) + count
# And to the words table.
row = words.setdefault(word, {})
row[genre] = row.get(genre, 0) + count
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
central servers. Currently all
users connected to kaishi are on the same level of the network, meaning
no user has more control over the others."
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
e -- list comps need to generate relatively similar code to
for-loops because they do relatively similar things.
Besides, in recent versions of Python the speed of for-loops is quite
good. The bottleneck is rarely the loop itself, but the work you do in
the loop or the size of the loop
; Sent: Sat, Oct 2, 2010 1:36 am
> Subject: Tutor Digest, Vol 80, Issue 10
[snip approx 150 irrelevant lines]
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
you're seriously considering a linear search over 450 thousand items
just to avoid doing a binary search, there's something seriously wrong.
Is it worth it? Log base 2 of 45 is less than 19, so the average
binary search will take 19 lookups. The average linear search will take
225
't let you accidentally modify a class attribute. You have to
do it explicitly. Here are three ways to do it:
type(f1).myid = 'Bar'
f1.__class__.myid = 'Bar'
Foo.myid = 'Bar'
(You might be able to do some sort of metaclass magic to change this
behaviour,
tically matches your data.
(8) Technically, you can calculate a regression line for *any* data,
even if it clearly doesn't form a line. That's why you are checking
the correlation coefficient to decide whether it is sensible or not.
By now any *real* statisticians reading this
per():
fname = "upper_%s" % fname.lower()
return os.path.join(base, fname + '.wav')
and then call it:
filenames = ['A', 'b', 'c', 'D', 1, 2, 3]
for name in filenames:
name = fix_filename(name)
sox_filenames.append(nam
count += 1
> else:
> print 'Lists are not same length for comparison'
> per = (100/lena)
> print count * per, '% match'
a = '+-+-+-+-+-+'
b = '-+-+---+---'
if len(a) != len(b):
raise ValueError('lists are not the same length')
count = sum(ca == cb for (ca, cb) in zip(a, b))
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
7;ll know the theory and math are correct!
Or you could use numpy and scipy, which are rapidly becoming the choice
for numeric and scientific applications over R.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or
wf file, I can't believe that you seriously believe
that the Python code is likely to be the bottleneck. If it takes ten
seconds to process the wav files into a swf file, who cares if you
speed the Python code up from 0.02 seconds to 0.01 seconds?
But I could be w
Eric
Raymond:
http://www.linuxjournal.com/article/3882
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ld copy and paste individual letters from another document.
We won't do your home work for you, but if you ask specific questions,
we will be happy to help.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change
. Please try again."
"Hey dummy, don't you know what a number is?"
although of course this requires more programming effort.
And naturally the condition functions can be as simple, or as
complicated, as you need.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ss forced.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
tax error.
>for f in filelist:
> allfiles.append(f)
This is better written as:
allfiles.extend(filelist)
but of course it is better to use the glob module.
> for i in allfiles:
> print i
> a.write(i)
> a.write("\n"
such-and-such a disease. Here's my bill for
$500."
My uncle got all indignant. "$500? You've hardly done anything! Why
should you get so much just because you've got a tool that does the
work for you?"
The specialist replied "The bill is $10 for my
ntence beginning with "Alan's answer to
Roelof...", and another sentence "This was your answer to Roelof",
everything in your post was a quote (started with a > sign). So what is
your question about lists of dicts?
--
Steven D'Aprano
_
s.python.org/library/stdtypes.html#string-formatting
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On Sun, 10 Oct 2010 03:59:26 am Emile van Sebille wrote:
> On 10/8/2010 8:55 PM Steven D'Aprano said...
>
> > I'm sorry to tell you that you've just reinvented the wheel. This
> > was already solved, a long, long time ago. It is called the glob
> > module:
aste the exact error
message, including the full traceback.
I suspect that you might need to read the documentation of the xlwt
project and see what it says. Perhaps the cell you are trying to
overwrite is locked?
--
Steven D'Aprano
___
Tuto
questions you should be asking yourself are:
- what value am I expecting it to contain?
- where in my code should that value be set?
- why is it setting None instead?
Armed with these three questions, you now know how to debug the problem
yourself.
--
Steven D'Aprano
_
n integer or a slice object, and behave accordingly.
http://docs.python.org/reference/datamodel.html#object.__getitem__
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
items in almost-but-not-quite alphabetical order.
Maybe it's just a fluke. They have to be in *some* order.
Since you haven't told us how you added them to the list, perhaps you
deliberately added them in that order and are trying to trick us. In
which case, HA! I see through your cunning trick!
*wink*
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
g ?
Each time through the loop, you set volgende to the same result:
nummer = re.search('[0-9]', inhoud)
volgende = int(nummer.group())
Since inhoud never changes, and the search never changes, the search
result never changes, and volgende never changes.
--
Steven D'Aprano
On Tue, 12 Oct 2010 11:58:03 pm Steven D'Aprano wrote:
> On Tue, 12 Oct 2010 11:40:17 pm Roelof Wobben wrote:
> > Hoi,
> >
> > I have this programm :
> >
> > import urllib
> > import re
> > f =
> > urllib.urlopen("http://www.pyth
code strings (characters) are
written using just " as the delimiter (or ' if you prefer), instead of
u" " as used by Python 2. Byte strings are written using b" " instead.
This makes the common case (text strings) simple, and the uncommon case
(byte strings) more
built-ins. They're
powerful but dangerous and slow, and making them built-ins just
encourages newbies to use them inappropriately.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
h
,4'.
Better is:
>>> s = '1, 200 , -3,4' # or whatever
>>> [int(x) for x in s.split(',')]
[1, 200, -3, 4]
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
nose firewall issues next. If you're trying to
connect from a computer in one school to a computer in another school,
both firewalls will almost certainly try to stop you.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To un
ond set:", b
which should print:
Sum of x from first set: 9
Sum of x from second set: 108
You should make similar adjustments to Y() and the other functions, and
then see how the assignment goes.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
the value of y that goes with the value of x=5, for the
regression line you calculated earlier. Then you move on to the second
set of data:
m = ... # something goes here
b = ... # something else goes here
y = line(95)
which calculates the y that goes with
>> str_to_list(u'[1,2,3,None]')
Traceback (most recent call last):
File "", line 1, in
File "", line 13, in str_to_list
ValueError: item `None` does not look like an int
Compared to eval and ast.literal_eval, both of which do too much:
>>> eval(u'{1:2}')
{1: 2}
>>> eval(u'[1,2,3,None]')
[1, 2, 3, None]
>>> ast.literal_eval(u'{1:2}')
{1: 2}
>>> ast.literal_eval(u'[1,2,3,None]')
[1, 2, 3, None]
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
:
'module' object has no attribute 'tmpl'
(There are other errors you could have got, but they're fairly obscure
and/or unusual.)
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
sation just to add a one sentence response at
the very end. Just leave enough to establish context, and anything you
are *directly* responding to.
Thank you.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subs
atform.
[...]
> newLine = [ch for ch in string.letters[0:9]]
What's wrong with this?
newline = list(string.letters[0:9])
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ctorial again...
Starting factorial calculation with n = 0
Done with n = 0 -- returning 1
Done with n = 1 -- returning 1
Done with n = 2 -- returning 2
Done with n = 3 -- returning 6
Done with n = 4 -- returning 24
Done with n = 5 -- returning 120
120
Notice the pattern of n values: the *f
mples that you should follow.
Putting the three of these together, your docstring should say
something like:
Given a float floatt and an integer n, returns floatt formatted
as a string to n decimal places.
>>> float2n_decimals(2, 81.34567)
'81.35'
(BTW, I real
d then call it with:
def is_ready():
url = 'http://' + env.host_string + '\:8080'
with settings(warn_only=True):
return urlopen_retry(url)
Hope this helps.
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
instead?
> I added .py to Windows IIS Web Service Extensions and to the
> Application Configuration.
How exciting! And what happened then?
--
Steven D'Aprano
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
e this:
>>> print "abc
File "", line 1
print "abc
^
SyntaxError: EOL while scanning string literal
We need to see the entire message, not just a vague description that
it's a syntax error.
--
Steven D'Aprano
eger arguments:
range(start, end, step)
where start and step are optional, defaulting to 0 and 1 respectively.
By starting the inner loop at i+1, you guarantee that j is always > i
and therefore you can skip the test.
The other change is that instead of
Vx = Vx + something
you can write:
ld have to be a *very* old version. The use of * as the width
parameter in format strings goes back to the Dark Ages of Python 1.5:
[st...@sylar ~]$ python1.5
Python 1.5.2 (#1, Apr 1 2009, 22:55:54) [GCC 4.1.2 20070925 (Red Hat
4.1.2-27)] on linux2
Copyright 1991-1
Richard D. Moores wrote:
What's the best way to model an unfair coin?
Let probability of heads = p, where 0 <= p <= 1
Then probability of tails = 1-p.
if random.random() <= p: print("got heads")
else: print("got tails")
[...]
That's the only way I can think of. But surely there's a better, m
Evert Rol wrote:
Btw, to be pedantic, 1/e is not an irrational number, just a real number. i/e
would be.
Actually, Richard is correct. Like π, e and 1/e are irrational numbers.
"Irrational" means the number is not rational, in the sense of *ratio*,
not sanity :)
There is no exact ratio of
Richard D. Moores wrote:
Actually, I used the unfair coin model as the simplest example of the
kind of thing I want to do -- which is to model the USD->Yen exchange
rate. I want the next quote to vary in a controlled random way, by
assigning probabilities to various possible changes in the rate.
Richard D. Moores wrote:
NameError: name 'np' is not defined
[...]
but where do I get np?
I believe that it is common in the scientific python world to do this:
import numpy as np
and then use np.FUNCTION instead of numpy.FUNCTION.
--
Steven
___
Jojo Mwebaze wrote:
Hello Tutor
I would like to compare two souce code files but ignoring doc strings,
comments and space (and perharps in future statement by statement
comparision)
e.g
class Foo
def foo():
# prints my name
return 'my name'
class Boo
def boo():
print 'my
Terry Green wrote:
def main():
pass
Useless function, does nothing. Why is it here?
if __name__ == '__main__':
main()
Also does nothing useful. Why is it here?
postPos=words[3]
This like will fail with NameError, because words is not defined anywhere.
This is not the code you
Luke Paireepinart wrote:
On Thu, Oct 28, 2010 at 8:11 PM, Steven D'Aprano wrote:
postPos=words[3]
This like will fail with NameError, because words is not defined anywhere.
This is not the code you are running. We can't tell what is wrong with the
code you run when you show us
Terry Green wrote:
Am running this Script and cannot figure out how to close my files,
Keep getting msg: Attribute Error: '_csv.writer' object has no attribute
'close'
Why?
Lesson one: we're not mind readers. To be able to give you useful
advise, we need to see the ACTUAL error and not a sum
Corey Richardson wrote:
If you can send a list, have the list [name, data] where name is the
file name and data is the raw binary of the file, contained in a string.
How do you send a list?
--
Steven
___
Tutor maillist - Tutor@python.org
To unsub
dave p. guandalino wrote:
Which of the following ways is better to handle something wrong? Many
thanks.
It depends on what you are trying to do.
# First:
def is_valid_project():
# Do checks and valorize is_a_valid_project accordingly
return is_a_valid_project # True / False
Do you
Jacob Bender wrote:
I have a few more ?'s.
Well, don't keep them a secret, tell us what they are! What are your
questions?
I was trying to make a program for ubuntu that
does one function: if ctrl + Alt + "t" is pressed, to shut down the
computer. There are only two problems. I want it to
Steven D'Aprano wrote:
Never (well, *almost* never) use print for printing error messages.
More information here:
http://en.wikipedia.org/wiki/Error_hiding
--
Steven
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscri
Chris King quoted Corey Richardson:
On 10/31/2010 12:03 PM, Corey Richardson wrote:
[...]
To read from a file, you open it, and then read() it into a string
like this:
for line in file:
string += string + file.readline()
Aii! Worst way to read from a file *EVAR*!!!
Seriously. Don'
Alan Gauld wrote:
"Chris King" wrote
How do I completely shutdown a computer without administrative
rights using a simple python script.
If you have such a computer get rid of it, it fails the most basic test
of a secure operating system. No program that runs upon it could
ever be relie
Chris King wrote:
it didn't work
Define "it" and "didn't work".
What did you try? What happened when you tried it?
--
Steven
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/l
Samuel de Champlain wrote:
Inside the class is a method with a bit of code:
def masque(chaine,liInd=0):
i = 0
lenght = len(chaine)
As this is a method, you normally need to refer to the instance in the
definition:
def masque(self, chaine, liInd=0):
i = 0
length
Chris King wrote:
I restarted the whole system with a script. Why couldn't I shut it down?
Probably because the script told the computer to restart rather than
shut down.
It will help if you tell us:
* what operating system you are running
* what you did to restart the computer
* what yo
Josep M. Fontana wrote:
The only time year is bound is in the previous loop, as I said. It's the
line that goes:
name, year = line.strip.
So year is whatever it was the last time through that loop.
OK, this makes sense. Indeed that is the value in the last entry for
the dictionary. Th
Josep M. Fontana wrote:
Sorry about the top-posting. Sometimes it seems that a little
top-posting might make things easier (I hate to have to go through
long quotes) but you are totally right, netiquette is netiquette.
To all the people who say "Never top-post", I say never say never --
there
Crallion wrote:
In an attempt to generate "true" random numbers,
Have you considered using your operating system's source of random numbers?
random.SystemRandom and os.urandom return numbers which are
cryptographically sound. They are also based on various sources of
physical randomness (whi
John wrote:
Hello, I thought the following should end with G[1] and G[0] returning
20. Why doesn't it?
In [69]: a = 10
In [70]: G = {}
In [71]: G[0] = [a]
In [72]: G[1] = G[0]
In [73]: a = 20
In [74]: G[1]
Out[74]: [10]
In [75]: G[0]
Out[75]: [10]
This doesn't actually have anything to do with
Chris King wrote:
Dear Tutors,
May server and client programs aren't working. They basically
simplify socket and SocketServer. Run them directly to test them. They
do work locally. They don't work from one computer to the next on the
same network. Please Help.
It's probably a network is
Alan Gauld wrote:
I don't use Ubuntu so don;t know the standard anmswer there but it will
depend on where the CD is mounterd.
I usually mount cdroms on /dev/cdrom
Surely that's where you mount cdroms *from*? I can't think that using
/dev/cdrom as the mount point would be a good idea!
Anyw
Terry Carroll wrote:
I have a program that traverses the directory of a CDROM using os.walk.
I do most of my work on Windows, but some on (Ubuntu) Linux, and I'd
like this to work in both environments.
On Windows, I do something along the lines of this:
startpoint="D:/"
What if the user h
Steven D'Aprano wrote:
But if you might have an external hard drive plugged in, or a USB key,
or similar, then you need to find out what the volume name of the
mounted CD drive is. That's a good question and I don't have an answer
right now. Let me think about it and get back
Luke Paireepinart wrote:
You don't get your own e-mails back.
I do.
Perhaps it's an option when you sign up?
--
Steven
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/
Danyelle Davis wrote:
Hi all,
Any suggestions for a newbie to program while learning python? I am new to
programming and python.
What are you interested in?
Interested in maths? Write a program to generate prime numbers, or to
search for amicable numbers. Look at Project Euler, although (i
Danyelle Davis wrote:
Hi all,
Any suggestions for a newbie to program while learning python? I am new to
programming and python.
Here's a few suggestions:
Write a program that asks the user to enter a word, then counts how many
vowels and consonants are in the word.
Write a program that
Terry Green wrote:
Am stumped, when I use this code:
race=int(row[2])
raceChek=1
This causes IndentationError: unexpected indent.
if raceChek == race: print ('raceChek ', raceChek, 'race ', race)
else: print ('raceChek ', raceChek,' no match ', 'race ', race);
raceChek = race
Richard D. Moores wrote:
So this version of my function uses a generator, range(), no?
def proper_divisors(n):
sum_ = 0
for x in range(1,n):
if n % x == 0:
sum_ += x
return sum_
I'm going to be pedantic here... but to quote the Middleman, specificity
is the so
Alan Gauld wrote:
"Steven D'Aprano" wrote
I'm going to be pedantic here... but to quote the Middleman,
specificity is the soul of all good communication.
Be pedantic! :-)
I really liked the explanation although I already sort of knew most of it.
But there were a few
Stefan Behnel wrote:
Hugo Arts, 08.11.2010 00:53:
[...]
On another note, getting rid of the list comprehension and using a
generator expression will be even faster, since you won't have to
build the list.
I gave this suggestion a try. It is true for me when run in CPython 3.2:
[...]
However
On Mon, Nov 08, 2010 at 03:28:44PM -0800, Natalie Kristine T. Castillo wrote:
> Hi, I need help on how exactly to solve this:
>
> To send secret messages you and your partner have decided to use the
> columnar function you have written to perform columnar transposition
> cipher for this course. You
401 - 500 of 3304 matches
Mail list logo