On 12/19/2012 12:40 AM, Brandon Merritt wrote:
I feel silly, but I'm having the darndest time trying to figure out
why this for counter won't work. I know that there is the count method
for the string class, but I was just trying to do it the syntactical
way to prove myself that I know the very
On 19/12/12 05:40, Brandon Merritt wrote:
the string class, but I was just trying to do it the syntactical way to
prove myself that I know the very basics.
Which is not a bad thing.
just returning 1 or 0, even if I very clearly make sure that I specify
at least 4 instances of the digit in my
On 12/19/2012 12:40 AM, Brandon Merritt wrote:
> I feel silly, but I'm having the darndest time trying to figure out why
> this for counter won't work. I know that there is the count method for the
> string class, but I was just trying to do it the syntactical way to prove
> myself that I know the
On 19/12/12 5:12 PM, Mitya Sirenef wrote:
> You can also do:
>
> count = sum(i==digit for i in number)
>
> I think this is very clear and short..
Another...
import re
count = len(re.findall(digit, number))
--
shantanoo
___
Tutor maillist - Tutor@py
After incrementing for a little while, if the condition i == digit is not
met for the current character, count is reset by the else: branch. Your
count variable must feel frustrated like a dog which keeps being yanked
back by a cord of length 0 when it tries to get free.
Trung Doan
==
On
On 12/19/2012 12:40 AM, Brandon Merritt wrote:
I feel silly, but I'm having the darndest time trying to figure out
why this for counter won't work. I know that there is the count method
for the string class, but I was just trying to do it the syntactical
way to prove myself that I know the very
I feel silly, but I'm having the darndest time trying to figure out why
this for counter won't work. I know that there is the count method for the
string class, but I was just trying to do it the syntactical way to prove
myself that I know the very basics. As of right now, my script is just
returni