Task-Switching in Builder view

Sorry to bother you again, but I’m still having trouble implementing this last part:

I’ve tried reviewing other forum posts similar to this (Record string response from keyboard and use Enter key to continue loop - #3 by movivi), but I have been unsuccessful so far.

I have this in my Each Frame tab in the secondary task routine:

# check the keyboard queue for events:
wp_response = event.getKeys()

if wp_response: # must allow for multiple key presses
    wp_response = wp_response.lower() 
    for key in keys:
        num_received = []
        num_received += answer
        if len(num_received) == num_required:

# amend the score accordingly:
            if answer == corrAns: # corrAns refers to the correct answer to the word problem, can be any key
                gainsThisBlock = gainsThisBlock + 5 # 5 points for a correct answer
                thisExp.addData('wordproblem_correct', 'True')
                continueRoutine = False
            else:
                gainsThisBlock = gainsThisBlock - 5 # minus 5 points for an incorrect answer
                thisExp.addData('wordproblem_correct', 'False')
        
         #go on to the next problem: 
                continueRoutine = False 

When I run this, I get the following error:
wp_response = wp_response.lower() AttributeError: 'list' object has no attribute 'lower'
I’m assuming this is due to my logic being off (or just completely wrong), but I’m not sure where it’s going wrong.

As an aside, would it be possible to record the time it takes for each key press (and the total time) for this task? I know this

thisExp.addData('response_rt', t)

works for my primary task, but I’m not sure if this is possible for trials with multiple key presses.

As always, thanks for your help!