reverse list issue
Hello
I have a corsi memory task all ready running with an inline.
In the task after 4 correct responses for a sequence of n trials, the experiment moves to a sequence of n+1.
If there were less then 4 out of 7 correct answers, the experiment ends.
Now I want to turn it into a working memory task so the correct order is the reverse order.
I am trying to change:
stiseq = sequence of stimlui respseq = sequence of responses made by the participant if stiseq==rspseq: var.set(u'acc', u'1') else: var.set(u'acc', u'0')
to this:
if stiseq==rspseq.reverse(): var.set(u'acc', u'1') else: var.set(u'acc', u'0')
I am getting the right values of stiseq and respseq,
but for some reson, acc always equals 0.
Any thought as to why this can happen? what have I done wrong?
Thank you!

Comments
Hi @labovich ,
The
list.reverse()function doesn't return thelistin reverse order. Rather, it changes the list itself (inplace) such that the elements are reversed. But the return value oflist.reverse()is alwaysNone.The normal (but pretty unintuitive) way to return a reversed
listis by slicing with steps of -1, like so:l[::-1]. In your case, this might work:if stiseq == rspseq[::-1]: var.set(u'acc', u'1') else: var.set(u'acc', u'0')Cheer!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Genius! Thank you so much!!