Suggestion regarding an inline script
I am building a task to assess working memory function. I have quick query. I want to display random number of letters for which I would like to create a variable that would contain random number of letters each time the variable is called. This variable is called 'letters'. I am thinking to define the variable on an inline code script which will be attached to the very beginning of the experiment. I am totally new to python.
The intention to define the variable in an inline script is to reduce the constrain on the experiment design since incorporating 26 levels (i.e., the number of English alphabets) under a single variable would cause the experiment to be too long with too many trials. However, using an inline code would deliver this by generating a unique alphabet every time the variable 'letters' is called in the trail.
Description of the task:
** A black “+” symbol is displayed at the center of the screen for 500 ms as a reminder to the participants to pay attention. Subsequently, a blank screen is displayed for approximately 600 ms before a letter loop appears. In a clock-like loop, 4–10 upper case letters are displayed in a random order for 1,500 ms each. After the letter loop disappears, the screen remains blank for 1,300–1,800 ms before a lowercase letter appears at the center of the screen for a further 1,500 ms. Participants must determine whether this letter was among the letters in the clock-like loop (irrespective of case). Subsequently, another blank screen is displayed for 1,000 ms, after which the task ends**
I have created the following code for this purpose.
var = random.choice(string_letters)
Questions 1: Is this the correct way to do it?
Question 2: I am not sure whether I should write the code in the pre-run phase or in the run phase?
Design for my experiment is:
ISI (with 6 levels) X stimulus_set ( 7 levels)
I would be grateful if someone could help in this please