I have a list of actions described with strings, ex "BPxPyPzPC" where each letter represents an action and C represents an event.
Some users' actions (such as "B", "Px", "Py" and "Pz") led to an event (in my example, the letter "C"), others did not, so I want to identify the pattern of actions (ex "BPxPyPz") that most often leads to the event, what is the most efficient way to do this in Python?
Thanks!
Example code:
c=['' for x in range(0,4)]
c[0]="BPxPxPyPC"
c[1]="BPxPyPyPC"
c[2]="BPyPxPyPC"
c[3]="BPyPxPyPC"
#do something
#desired result
The most likely sequence of actions to achieve "C" is "BPyPxPy"