0

Few issues with this code.

https://code.sololearn.com/cIE353eB2OAU/?ref=app Here the code works just fine for what it is made for but when I input a text with more then 1 recurring characters it prints both of them.. tried fixing it up with break statement but it messes up the program like Using break: Input abba Output a Output should be b in this case.

11th Aug 2019, 7:57 AM
Rohit Panchal
Rohit Panchal - avatar
3 Respostas
+ 1
Well one idea, you could keep a list of the recurring letters in order of which they first repeat and if you just want the first, then you can print the first element in that list. recurring = [] for i in text: for j in list_in: if i == j: recurring.append(i) list_in.append(i) print(recurring[0])
11th Aug 2019, 8:40 AM
Jake
Jake - avatar
0
Jake yeh that would be a great idea but maybe I'm looking for something to fox that without adding few new things
11th Aug 2019, 8:44 AM
Rohit Panchal
Rohit Panchal - avatar
0
Fix*
11th Aug 2019, 8:44 AM
Rohit Panchal
Rohit Panchal - avatar