.join(), .replace() and * on text
"".join(parts) glues a list of text into one string. p.replace("k", "x") swaps every k for an x. And "x." * 4 repeats text.
Challenge A:p = "k.s.k.s.". Play the snare wherever there's an "s", then change every k to x with p = p.replace("k", "x") and play the kick wherever there's an "x".