Count and say python 3 solution easy and simple


#1

class Solution:
# @param A : integer
# @return a strings
def countAndSay(self, A):
l=[“1”,“11”,“21”]
i=2
while i<=A+2:
t=""
c=1
j=0
while j<(len(l[i])-1):
if l[i][j]==l[i][j+1]:
c=c+1
j=j+1
else:
t=t+str©+l[i][j]
c=1
j=j+1
if i==2:
t=t+str(l[i].count(l[i][j]))+l[i][j]
if c!=1:
t=t+str©+l[i][j]
if c==1 and i!=2:
t=t+“1”+l[i][j]
i=i+1
l.append(t)
return l[A-1]