I need to receive a string from the user, present it in list so each organ in the list contains [the letter, the number it repeat in a row].
I thought my code is goo
Simpler variant of Aswini's code:
string = raw_input("Enter a string:") lis = [] for c in string: if len(lis) != 0 and lis[-1][0] == c: lis[-1][1] += 1 else: lis.append([c, 1]) print lis