On 09/28/10 13:57, Bill Allen wrote:
I can now see that quite a bit of the code I write dealing with lists
can be done with list
comprehensions. My question is this, is the list comprehension styled
code generally
more efficient at runtime? If so, why?
Yes, because the looping in list
Thanks David, But the loop was suppose to produce the count of even divisors an
integer has.
Like, 6 has 2 even divisors, which is 2 and 6, itself.
8 = 3 even divisors, which is 2, 4 ,and 8
10 = 2 even divisors, which is 2, and 10
12 = 4 even divisors, which is 2, 4, 6, and 12
sorry, I just
Hi all,
I've been trying to write a programme that solves sudoku problems for a
while now. I'm getting close, but would like to ask a few questions about
the most pythonic way of doing some things.
I've decided to create nested lists (row order, column order and square
order) which correspond with
thanks for the reply. i should have been more specific in my question ;)
the order in which 'other' is listed is not always the last item of
the list as it is dependent on where in the CSV file it is included.
what i was trying to do is to take create the list of dictionary items
and then find
Hello all,
I am currently trying to write a program which can find the solution to a
game of hangman.
In a part of the program, a user inputs a letter, a tester tells him if
the word contains that letter, and then if the answer is no, all words
containing that letter are removed from the list of
Hi I am trying to learn how to program, I want to become a software developer
so
I can develop a software and also understand how to write my own software not
copying someone else. So if there any book or online tutorials for complete
beginners. I went to the python website and on wiki python
Dear Tutor:
I would like to install a program that was written with python 3.1, the
computer that I would like to put in on has Win 98SE. I tried Python 3.1.2 MSI
and 2.61 but got a message that a DLL was not there and would not install. I
then tried them on a Win 7 computer and got to the 5
Hi,
I'm relatively new to this mailing list (and python!) and I would greatly
appreciate some exercises to try or something to get me familiar with the
system.
Thanks,
Cameron Macleod
___
Tutor maillist - Tutor@python.org
To unsubscribe or change
I am very much new to python, and thus I am likely to feel stupid
about asking. But I need to get past this to continue with my work.
I need pyMVPA module to run some analysis on fMRI data, but as a start
I want to at first play around with the sample data provided on pyMVPA
website. I have
you can use an re split...
import re
a=raw_input(Enter the number of your class in the school:)
regex = re.compile([ ,]) #sets the delimeters to a single space or comma
m = regex.split(a)
if you want to use any white space character than you can use [\s,]
2010/9/23 Ahmed AL-Masri
Hello tutor at python.org.
How can I write strings to the console in a way that will give the same result
in Python 3 and Python 2?
I tried sys.stdout.write('hello') on Microsoft vista.
with python 3.1.2
sys.stdout.write('hello')
hello5
with python 2.7
sys.stdout.write('hello')
hello
Why
On Sun, Sep 26, 2010 at 9:20 AM, Preetinder Singh putj...@yahoo.com wrote:
Hi I am trying to learn how to program, I want to become a software
developer so I can develop a software and also understand how to write my
own software not copying someone else. So if there any book or online
On 27/09/2010 17:11, Thierry Tung wrote:
Hello tutor at python.org.
How can I write strings to the console in a way that will give the same result
in Python 3 and Python 2?
I tried sys.stdout.write('hello') on Microsoft vista.
with python 3.1.2
sys.stdout.write('hello')
hello5
with
On 25/09/2010 20:44, D Ryan (2) wrote:
Hello all,
I am currently trying to write a program which can find the solution to a
game of hangman.
In a part of the program, a user inputs a letter, a tester tells him if
the word contains that letter, and then if the answer is no, all words
containing
Just home from vacation so jumping in late...
Roelof Wobben rwob...@hotmail.com wrote
class tijd :
pass
Others have solved this for you but you don't appear to have picked
up on the point made by Jeremy that you are not initialising your
class's attributes.
By only creating the
On Sat, Sep 25, 2010 at 11:50 PM, Preetinder Singh putj...@yahoo.com wrote:
Hi I am trying to learn how to program, I want to become a software
developer so I can develop a software and also understand how to write my
own software not copying someone else. So if there any book or online
Preetinder Singh putj...@yahoo.com wrote
copying someone else. So if there any book or online tutorials for
complete
beginners. I went to the python website and on wiki python and there
are so many
books to choose from, please help me choose one.
There are many because people learn in
Marc Tompkins marc.tompk...@gmail.com wrote
The parentheses are optional in 2.6, mandatory in 3. In 2.6, print
and
print() are alternate ways to invoke the print statement
Not strictly true. They often give the same results but not always,
see a recent thread on this. In particular
roberto robert...@gmail.com wrote
i have the following error when i call this function:
20 def outOfBounds():
--- 21 if abs(turtle.position()[0])
turtle.window_height()/2 or abs(turtle.position()[1])
turtle.window_width()/2:
22 return true
23 else:
Cameron Macleod cmacleod...@gmail.com wrote
I'm relatively new to this mailing list (and python!) and I would
greatly
appreciate some exercises to try or something to get me familiar
with the
system.
Are you new to programming? Or just new to Python?
In erither case there are a wealth of
I go with Alan.
If you however arrive at a choice book or books, send me a list of the
books, I will check if I have any of them. I have plenty books on
python now.
You may not need to send a personal mail, just send it here on the
forum and i would send you a download link.
I hope by that
masawudu bature mass0...@yahoo.ca wrote
The output is suppose to count the number of even divisors the range
has.
You need to work this through again in your head:
def evenCount(b) :
This function takes a parameter b but you never use b in the
function...
for n in range(x, y+1) :
It seems that ur turtle.position doesn't return a list because of this when
indexing is done on that u get this kind of error.
--nitin
On Tue, Sep 28, 2010 at 3:39 PM, Alan Gauld alan.ga...@btinternet.comwrote:
roberto robert...@gmail.com wrote
i have the following error when i call this
On Tue, 28 Sep 2010 02:15:52 pm masawudu bature wrote:
I'm having a hard time finding the count of divisors that are even.
Help anybody?
Here's my code.
The output is suppose to count the number of even divisors the range
has.
I don't understand the question. What do you mean by divisors
On Tue, 28 Sep 2010 06:55:15 pm Christian Witts wrote:
You are mutating the list that you are iterating over so in essence
you are looking at the word in list index 0, testing it, and removing
it, then moving onto list index 1 but now your list has 'amazing' in
index 0 so that does not get
On Tue, 28 Sep 2010 01:57:23 pm Bill Allen wrote:
I can now see that quite a bit of the code I write dealing with lists
can be done with list
comprehensions. My question is this, is the list comprehension
styled code generally
more efficient at runtime? If so, why?
List comprehensions
You might also consider the following free resources that are meant for new
programmers. They can easily be found on the internet:
How to Think Like a (Python) Programmer
by Allen Downey
Dive Into Python
20 May 2004
Copyright © 2000, 2001, 2002, 2003, 2004 Mark Pilgrim
On Tue, 28 Sep 2010 07:37:12 pm Jeremy Jones wrote:
Head First Programming: A Learner's Guide to Programming Using the
Python Language by David Griffiths and Paul Barry was a great read.
It's unconventional (by their nature, all Head First books are),
I've never heard of Head First
On Tue, 28 Sep 2010 11:56:33 am Alex Hall wrote:
(But don't forget that Python is not necessarily written in C.
There's Jython, written in Java, and CLPython written in Lisp, and
many others. How they implement objects may be different. What
happens under the hood isn't important, so long
Hello,
Im now studying this page :
http://openbookproject.net/thinkcs/python/english2e/ch16.html
But I don't get it why aces are now lower then deuces in the cmp function.
Roelof
___
Tutor maillist -
On 9/28/10, Steven D'Aprano st...@pearwood.info wrote:
On Tue, 28 Sep 2010 11:56:33 am Alex Hall wrote:
(But don't forget that Python is not necessarily written in C.
There's Jython, written in Java, and CLPython written in Lisp, and
many others. How they implement objects may be different.
On 2/18/2010 8:10 AM Juli said...
I am very much new to python, and thus I am likely to feel stupid about
asking. But I need to get past this to continue with my work.
I need pyMVPA module to run some analysis on fMRI data, but as a start I
want to at first play around with the sample data
Hi,
I am very much new to python, and thus I am likely to feel stupid about
asking. But I need to get past this to continue with my work.
I need pyMVPA module to run some analysis on fMRI data, but as a start I want
to at first play around with the sample data provided on pyMVPA website.
On 2:59 PM, Roelof Wobben wrote:
Hello,
Im now studying this page :
http://openbookproject.net/thinkcs/python/english2e/ch16.html
But I don't get it why aces are now lower then deuces in the cmp function.
Roelof
Why would you be surprised that aces are lower than deuces? If aces are
On Tue, Sep 28, 2010 at 6:39 AM, Alif Shirali alifshir...@hotmail.comwrote:
You might also consider the following free resources that are meant for
new programmers. They can easily be found on the internet:
I'll toss another recommendation into the ring:
Snake Wrangling for Kids.
It may be
On Tue, Sep 28, 2010 at 5:02 AM, Alan Gauld alan.ga...@btinternet.comwrote:
Marc Tompkins marc.tompk...@gmail.com wrote
The parentheses are optional in 2.6, mandatory in 3. In 2.6, print and
print() are alternate ways to invoke the print statement
Not strictly true. They often give
thanks for the reply, i think i have it now, perhaps it could be done better
http://pastie.org/1186545
On Tue, Sep 28, 2010 at 2:56 PM, Emile van Sebille em...@fenx.com wrote:
Hi Norman,
Read my reply again -- that's the second question I answered.
Emile
On 9/28/2010 12:56 AM Norman
On 2:59 PM, Alex Hall wrote:
On 9/28/10, Steven D'Apranost...@pearwood.info wrote:
snip
PyPy is a version of Python written in Python. It has an incredible
mission: to eventually produce versions of Python which are faster than
pure C, despite being written in Python itself. Although they
I read python from novice to professinal. I also read a lot of online guides
sometimes more beneficial than the books.
These links should help you
http://wiki.python.org/moin/BeginnersGuide
http://www.awaretek.com/tutorials.html
___
Tutor maillist -
From: rwob...@hotmail.com
To: da...@ieee.org
Subject: RE: [Tutor] question
Date: Tue, 28 Sep 2010 14:22:17 +
Date: Tue, 28 Sep 2010 10:02:27 -0400
From: da...@ieee.org
To: rwob...@hotmail.com
CC: tutor@python.org
Subject: Re: [Tutor] question
On 2:59 PM, Roelof Wobben
On Tue, Sep 28, 2010 at 7:47 AM, Steven D'Aprano st...@pearwood.info wrote:
On Tue, 28 Sep 2010 07:37:12 pm Jeremy Jones wrote:
Head First Programming: A Learner's Guide to Programming Using the
Python Language by David Griffiths and Paul Barry was a great read.
It's unconventional (by their
On 9/28/2010 10:22 AM, Roelof Wobben wrote:
Date: Tue, 28 Sep 2010 10:02:27 -0400
From: da...@ieee.org
To: rwob...@hotmail.com
CC: tutor@python.org
Subject: Re: [Tutor] question
On 2:59 PM, Roelof Wobben wrote:
Hello,
Im now studying this page :
Norman Khine wrote:
thanks for the reply, i think i have it now, perhaps it could be done
better
topics.sort(key=itemgetter('name'))
for i, t in enumerate(topics):
... for (k, v) in t.iteritems():
... if v == 'other':
... topics.append(topics.pop(i))
On 9/28/2010 7:12 AM Norman Khine said...
thanks for the reply, i think i have it now, perhaps it could be done better
I think I'd use a helper function to sort:
def sortOtherToEnd(val):
if val['name'] == 'other:
return ''
return val['name']
#then sort it
D Ryan (2) wrote:
Hello all,
I am currently trying to write a program which can find the solution to a
game of hangman.
In a part of the program, a user inputs a letter, a tester tells him if
the word contains that letter, and then if the answer is no, all words
containing that letter are
thank you, here is the updated version:
http://pastie.org/1186860
On Tue, Sep 28, 2010 at 5:50 PM, Emile van Sebille em...@fenx.com wrote:
On 9/28/2010 7:12 AM Norman Khine said...
thanks for the reply, i think i have it now, perhaps it could be done
better
I think I'd use a helper
On 9/28/2010 9:37 AM Norman Khine said...
thank you, here is the updated version:
http://pastie.org/1186860
The only obvious redundancy is the duplicated sort of options just
before the return. You only need the newer sort_key based one.
Emile
On Tue, Sep 28, 2010, Lie Ryan wrote:
On 09/28/10 13:57, Bill Allen wrote:
I can now see that quite a bit of the code I write dealing with lists
can be done with list
comprehensions. My question is this, is the list comprehension styled
code generally
more efficient at runtime? If so, why?
ok, great.
one thing i wanted to ask is how could i extend the class so that i
can just change the name of the csv file?
On Tue, Sep 28, 2010 at 6:53 PM, Emile van Sebille em...@fenx.com wrote:
On 9/28/2010 9:37 AM Norman Khine said...
thank you, here is the updated version:
On Tue, Sep 28, 2010 at 12:35 PM, Nitin Das nitin@gmail.com wrote:
It seems that ur turtle.position doesn't return a list because of this when
indexing is done on that u get this kind of error.
--nitin
it seemed to me that kind of error but then i found that it was a
list, as expected:
$
It seems that ur turtle.position doesn't return a list because of this when
indexing is done on that u get this kind of error.
--nitin
it seemed to me that kind of error but then i found that it was a
list, as expected:
$ type(turtle.position())
$ type 'list'
$
Hello dear pythonists:
I'm developing an application in python, I'm new using this programming
language I used to work with Java, but in my job my superiors suggested me
to develop in this language.
I'm trying to read a dbf file, I already done it but my code shows me all
the lines without
On 9/28/10, Dave Angel da...@ieee.org wrote:
On 2:59 PM, Alex Hall wrote:
On 9/28/10, Steven D'Apranost...@pearwood.info wrote:
snip
PyPy is a version of Python written in Python. It has an incredible
mission: to eventually produce versions of Python which are faster than
pure C, despite
From: rwob...@hotmail.com
To: da...@ieee.org
Subject: RE: [Tutor] question
Date: Tue, 28 Sep 2010 19:14:29 +
Date: Tue, 28 Sep 2010 10:49:28 -0400
From: da...@ieee.org
To: rwob...@hotmail.com; tutor@python.org
Subject: Re: [Tutor] question
On 9/28/2010 10:22 AM, Roelof
On Tue, Sep 28, 2010 at 2:33 PM, Susana Iraiis Delgado Rodriguez
susana.delgad...@utzmg.edu.mx wrote:
Hello dear pythonists:
I'm developing an application in python, I'm new using this programming
language I used to work with Java, but in my job my superiors suggested me
to develop in this
On Wed, Sep 29, 2010 at 1:33 AM, Corey Richardson kb1...@aim.com wrote:
Hello tutors.
I hate doing this:
string = string.lower()
Is there a way to do it without the string = part? Thanks.
1. string is a module which is deprecated. You should probably use str or s
in your
On 28-Sep-10 13:03, Corey Richardson wrote:
I hate doing this:
string = string.lower()
Is there a way to do it without the string = part? Thanks.
Depends on the class. In this specific case, string objects are
immutable (for some good reasons which are beyond the immediate point),
so once
On Tue, Sep 28, 2010 at 3:03 PM, Corey Richardson kb1...@aim.com wrote:
Hello tutors.
I hate doing this:
string = string.lower()
Is there a way to do it without the string = part? Thanks.
I suppose the best answer is it depends on what you are doing with
string after you do
Thanks for the replies, Dave and Joel. The reason I'm not just using the
time or datetime modules for a random date is because it's restricted to
1970-2038; I'm pulling dates from 1600-3099. Thanks a lot for the pointer
about the leap years, Dave, as well the class instances; just updated it and
On Wed, 29 Sep 2010 06:03:21 am Corey Richardson wrote:
Hello tutors.
I hate doing this:
string = string.lower()
Is there a way to do it without the string = part? Thanks.
No, strings are immutable. Once they're created, they cannot be changed.
This is no different from:
x
On Wed, 29 Sep 2010 04:33:51 am Susana Iraiis Delgado Rodriguez wrote:
Hello dear pythonists:
I'm developing an application in python, I'm new using this
programming language I used to work with Java, but in my job my
superiors suggested me to develop in this language.
I'm trying to read a
On Wed, 29 Sep 2010 06:12:20 am Shashwat Anand wrote:
On Wed, Sep 29, 2010 at 1:33 AM, Corey Richardson kb1...@aim.com
wrote:
Hello tutors.
I hate doing this:
string = string.lower()
Is there a way to do it without the string = part? Thanks.
1. string is a module which
Hi all, yet again:
I have a dictionary that will look something like:
d={
(1,2):a,
(3,4):b
}
How can I say:
if (1,2) in d: print d[(1,2)]
This is false, so I expect to have to use d.keys, but I am not quite sure how.
I will be using this in a loop, and I have to know if there is a key
in the
On Tue, Sep 28, 2010 at 4:58 PM, Alex Hall mehg...@gmail.com wrote:
Hi all, yet again:
I have a dictionary that will look something like:
d={
(1,2):a,
(3,4):b
}
How can I say:
if (1,2) in d: print d[(1,2)]
This is false, so I expect to have to use d.keys, but I am not quite sure
how.
On 28-Sep-10 14:58, Alex Hall wrote:
Hi all, yet again:
I have a dictionary that will look something like:
d={
(1,2):a,
(3,4):b
}
How can I say:
if (1,2) in d: print d[(1,2)]
Did you try this? It looks fine to me as it is.
(1,2) is an immutable value (a tuple), so it is able to be used
On Wed, 29 Sep 2010 07:58:28 am Alex Hall wrote:
Hi all, yet again:
I have a dictionary that will look something like:
d={
(1,2):a,
(3,4):b
}
How can I say:
if (1,2) in d: print d[(1,2)]
Exactly like that:
d = {(1,2): 'a', (3,4): 'b'}
if (1,2) in d: print d[(1,2)]
...
a
This is
On 28 September 2010 23:58, Alex Hall mehg...@gmail.com wrote:
Hi all, yet again:
I have a dictionary that will look something like:
d={
(1,2):a,
(3,4):b
}
How can I say:
if (1,2) in d: print d[(1,2)]
This will work fine.
This is false
Not it is not..
d = {(1,2):a,(3,4):b}
(1,2)
making games is the best way to learn programming, and the book is free
http://programming.gather.com/viewArticle.action?articleId=281474978440241
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
Steven D'Aprano st...@pearwood.info wrote
I've never heard of Head First Programming -- how are they
unconventional?
They are a bit too cutesy for my liking, slow to get to any depth
but engaging for the sound-byte generation. Lots of cartoons and
jokes. I'd say its a bit like O'Reilly's take
On 9/28/2010 5:11 PM, Carter Danforth wrote:
Thanks for the replies, Dave and Joel. The reason I'm not just using the
time or datetime modules for a random date is because it's restricted to
1970-2038; I'm pulling dates from 1600-3099. Thanks a lot for the pointer
about the leap years, Dave, as
70 matches
Mail list logo