[Tutor] need help with python for counter

Alan Gauld alan.gauld at btinternet.com
Wed Dec 19 11:11:04 CET 2012


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 number string:
>
> number = raw_input('Enter a 7-unit number: ')
>
> digit = raw_input('Enter a single digit: ')
>
> for i in number:
>      count = 0

you reset count to zero everytime round the loop.
You need to move this outside the loop.


HTH

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list