I am looking for help when trying to add in a space on a free response question in my experiment. At first I was having the issue where the word “space” was just butting put in there (ex. itspacewouldspacelookspacelikespacethisspace) but then figured out how to remove the word being put int. Now I am having the issue where nothing is changing (ex. itwouldlooklikethis). I have tried searching previous forums and tutorials online but cant find anything that has solved the issue. I am sure this is a simple solution and something I am just missing since I am not familiar with python coding but any help would be greatly appreciated. Thank you! I have added in relevant information below.
In begin routine:
maxDigits = 500
#key logger defaults
last_len = 0
key_list = 
In Each Frame: #if a new key has been pressed since last time
if(len(keyresp_3.keys) > last_len):
#increment the key logger length
last_len = len(keyresp_3.keys)
#grab the last key added to the keys list
#check for backspace
if("backspace" in key_list):
#if we have at least 1 character, remove it
if(len(key_list) > 0):
#if enter is pressed then...
elif("return" in key_list):
#remove the enter key
#if space is pressed then...
if("space" in key_list):
#add in a space rather than "space"
if(len(key_list) > 1):
respDisplayThree += ' '
#now loop through and remove any extra characters that may exist
while(len(key_list) > maxDigits):
#create a variable to display
respDisplayThree = ''.join(key_list)
In end routine: