Re: Problem with for and if

2015-01-06 Thread Erik Cederstrand
> Den 05/01/2015 kl. 22.45 skrev Dariusz Mysior : > > I try develop this code to get a number of position this letter in word, and > I have it but for example if i search letter "t" I get "1, 5, b", why I get b > instead of 11??? > > def gen2(): >count=0 >count2=0 >for a in zmienna

Re: Problem with for and if

2015-01-05 Thread Dariusz Mysior
I try develop this code to get a number of position this letter in word, and I have it but for example if i search letter "t" I get "1, 5, b", why I get b instead of 11??? def gen2(): count=0 count2=0 for a in zmienna: count2+=1 if a==szukana: count+=1

Re: Problem with for and if

2015-01-05 Thread Zoltán Bege
You should use the string's count method: zmienna.count(szukana) See help("string.count") On Monday, January 5, 2015 4:32:06 PM UTC+2, Dariusz Mysior wrote: > > I want search count of szukana in zmienna but code below counting all 12 > letters from "traktorzysta" word > > szukana="t" > zmienna