I'll try to explain how I would do it...
You make all the piano keys instances of the same sprite with an instance variable note to store the name of the note.
Then you have two variables: solution to store the answer and input to store the player input.
So at the start you set solution to a random sequence of notes.
solution = "cdecd"
When the player clicks a key then you add its note value to the input string.
Say the player clicks the c key:
input = "c"
Using the text expressions: len(text) and left(text, count) you compare the input to the solution.
The length of the input is 1 so you compare it to the first character of the solution.
Then the player clicks "d". You add that to the input so the input is now "cd" - length 2. Compare to the first two characters of the solution.
Keep going until the input is the same length as the solution and it matches.
If at any point the input doesn't match the first n characters of the solution then they have clicked the wrong key.