# Recording two consecutive (correct) answers in one trial

**URL:** <https://discourse.psychopy.org/t/recording-two-consecutive-correct-answers-in-one-trial/8970>\
**Category:** Coding\
**Created:** [September 6, 2019, 2:49pm UTC](https://discourse.psychopy.org/t/recording-two-consecutive-correct-answers-in-one-trial/8970 "2019-09-06T14:49:06Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Mardock](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@Mardock](https://discourse.psychopy.org/u/Mardock)\
**Post date:** [September 8, 2019, 8:08am UTC](https://discourse.psychopy.org/t/recording-two-consecutive-correct-answers-in-one-trial/8970/3 "2019-09-08T08:08:38Z")

</div>

Ok, so finally I managed to find a solution, mostly thanks to this post: [End routine after TWO key presses](https://discourse.psychopy.org/t/end-routine-after-two-key-presses/2132/6)

I adapted @Oli’s code component:

```auto
    theseKeys = key_resp_1.getKeys(('space','r'), waitRelease=False)
    if theseKeys:
        if "escape" in theseKeys:
            endExpNow = True
        else:
            thisResp.append(theseKeys)
            if len(thisResp) ==2:
                continueRoutine = False

```

And of course, don’t forget to create an empty list at the beginning of the trial:

```auto
thisResp = []

```

It works perfectly! 😉

---

_[View the full topic](https://discourse.psychopy.org/t/recording-two-consecutive-correct-answers-in-one-trial/8970)._
