Created
May 3, 2016 13:10
-
-
Save anonymous/28d5fab8b59ddcb3bcfc7befa63a5881 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rle(str): | |
z="" | |
for i in str: | |
if i in z: | |
print("") | |
else: | |
z=z+i | |
for i in z: | |
ch="" | |
c=0 | |
k=0 | |
while k<len(str): | |
if i == str[k]: | |
c=c+1 | |
k=k+1 | |
print(c, i, end=" ") | |
return(ch) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Si tu veux vraiment faire comme ça...
boucle 1
i in z
n'est pas bonne. Tu veux juste vérifier si i est le dernier caractère dez
.boucle 2
k
ne parcourt pas les bonnes valeur. Il ne doit pas commencer à 0, mais à l'endroit où tu es dans ton parcours destr
. Tu dois sortir de ta boucle dès que tu rencontre un caractère différent.Notes
str
.str
est une fonction, en python.