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 th
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 re
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 a
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 fi
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 sub
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 d
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
> Hi,
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')
hel
On Sun, Sep 26, 2010 at 9:20 AM, Preetinder Singh 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
> tutorials for comple
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 py
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 th
Just home from vacation so jumping in late...
"Roelof Wobben" 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 attributes within the funct
On Sat, Sep 25, 2010 at 11:50 PM, Preetinder Singh 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
> tutorials for comple
"Preetinder Singh" 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 different ways.
My t
"Marc Tompkins" 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
print ('a','b')
is quite
"roberto" 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:
TypeError: 'f
"Cameron Macleod" 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 tutorials suited to
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 everyone
"masawudu bature" 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) :
What are x and
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 wrote:
>
> "roberto" wrote
>
>
> i have the following error when i call this function:
>> 20 def outOfBounds():
>>
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 "div
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 comprehensio
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
(mailto:m...@diveintopyt
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 Prog
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, s
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 - Tut
On 9/28/10, Steven D'Aprano 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. What
>> >
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 provid
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 websit
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 wrote:
> 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 geared towards young
On Tue, Sep 28, 2010 at 5:02 AM, Alan Gauld wrote:
>
> "Marc Tompkins" 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,
> se
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 wrote:
> Hi Norman,
>
> Read my reply again -- that's the second question I answered.
>
> Emile
>
>
> On 9/28/2010 12:56 AM Norman Khine said
On 2:59 PM, Alex Hall wrote:
On 9/28/10, Steven D'Aprano wrote:
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 have a
long, long way to
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
On Tue, Sep 28, 2010 at 7:47 AM, Steven D'Aprano 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 nature, al
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 :
http://openbookproject.net/thinkcs/pytho
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(top
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
topics.sort(key=sortOth
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
thank you, here is the updated version:
http://pastie.org/1186860
On Tue, Sep 28, 2010 at 5:50 PM, Emile van Sebille 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 function t
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? I
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 wrote:
> On 9/28/2010 9:37 AM Norman Khine said...
>>
>> thank you, here is the updated version:
>>
>> http://pastie.org/118
On Tue, Sep 28, 2010 at 12:35 PM, Nitin Das 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:
$ type(turtle.posi
>> 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())
> $
> $ abs(turtle.position()[
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 spaces,
On 9/28/10, Dave Angel wrote:
>
>
> On 2:59 PM, Alex Hall wrote:
>> On 9/28/10, Steven D'Aprano wrote:
>>>
>>>
>>> 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
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
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 r
Hello tutors.
I hate doing this:
string = string.lower()
Is there a way to do it without the "string =" part? Thanks.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/li
On Wed, Sep 29, 2010 at 1:33 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.
>
1. string is a module which is deprecated. You should probably use str or s
in your example.
2.
On Tue, Sep 28, 2010 at 3:03 PM, Corey Richardson wrote:
> Hello tutors.
>
> I hate doing this:
>string = string.lower()
>
> Is there a way to do it without the "string =" part? Thanks.
>
Not with a string. I suppose if you had your own class you could create
something, but you'd be
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 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 string.lo
On 9/28/2010 11:13 AM Norman Khine said...
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?
Python provides for instance initialization with a class __init__
method, so you could modify your class as follows:
def sort
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
it
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'Aprano to add the fine print ;)
I'l
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 fr
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 rea
On Wed, 29 Sep 2010 06:12:20 am Shashwat Anand wrote:
> On Wed, Sep 29, 2010 at 1:33 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.
>
> 1. string is a module whic
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 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 use
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)]
On 28 September 2010 23: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)]
This will work fine.
> This is false
Not it is not..
>>> d = {(1,2):"a",(3,4):"b"}
>>> (
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:
http://mail.python.o
"Steven D'Aprano" 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 the Dummie
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
71 matches
Mail list logo