On 11/19/2011 04:59 PM, Dave Angel wrote:
On 11/19/2011 01:36 AM, Kĩnũthia Mũchane wrote:
On 11/19/2011 06:03 AM, Asokan Pichai wrote:
Another way to do that is to avoid any intermediate variables
altogether
That may be easier to understand YMMV
def counter(mylist, val):
if len(mylist
Hi,
I am trying to do something which is really stupid :-)
I would like to count the number of occurrences of a certain character
in a list.
This is more of an exercise in recursion rather than the underlying problem.
I could have used a *for* loop or simply the list *count* method.
Here is
On 11/18/2011 06:04 PM, Dave Angel wrote:
On 11/18/2011 08:16 AM, Kĩnũthia Mũchane wrote:
snip
Well, it doesn't count the number of occurrences correctly if the list
is empty. It should get zero, and it gets -1. But for any non-empty
list, nothing ever looks at the -1 value, so it doesn't
On 11/19/2011 06:03 AM, Asokan Pichai wrote:
Another way to do that is to avoid any intermediate variables altogether
That may be easier to understand YMMV
def counter(mylist, val):
if len(mylist == 0):
return 0
if mylist[0] == val:
return 1 +
On 09/23/2011 11:28 PM, Wayne Werner wrote:
On Fri, Sep 23, 2011 at 2:25 PM, ADRIAN KELLY kellyadr...@hotmail.com
mailto:kellyadr...@hotmail.com wrote:
snip
can anyone explain the *_tries_* part of this programme to me i
know its meant to count the number of guesses made by the
On 06/13/2011 12:17 AM, R. Berman wrote:
Having followed this absurd thread from its beginning hopefully to this, the
end of it. Everyone replying to your diatribe has been incredibly polite to
you. One of the moderators tried to explain the obvious to you. This is a
Python group. Python is
On 06/11/2011 06:51 PM, Piotr Kamiński wrote:
Dnia 11-06-2011 o 17:30:50 Alan Gauld alan.ga...@btinternet.com
napisał(a):
Piotr Kamiński piotr-...@o2.pl wrote
This is a *technical* list, as I understand it, solely dedicated
to the
technical side of teaching the *Python* programming
On 06/11/2011 08:02 PM, davidheise...@gmail.com wrote:
I think Steven and Alan misunderstood the Rayon's question.
What is 1 + 1?
David I am with you.
Rayon is using his telnet script to pass commands to a device ONE AT A
TIME. Then he breaks the connection and reconnects for the next