# Feedback contingent on response

**URL:** <https://discourse.psychopy.org/t/feedback-contingent-on-response/10138>\
**Category:** Builder\
**Created:** [December 2, 2019, 9:11pm UTC](https://discourse.psychopy.org/t/feedback-contingent-on-response/10138 "2019-12-02T21:11:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evi\_Myftaraj](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/evi_myftaraj/32/6405_2.png) [@Evi\_Myftaraj](https://discourse.psychopy.org/u/Evi_Myftaraj)\
**Post date:** [December 2, 2019, 9:11pm UTC](https://discourse.psychopy.org/t/feedback-contingent-on-response/10138/1 "2019-12-02T21:11:21Z")

</div>

**OS** (e.g. Win10): MacBook v10.10.5  
**PsychoPy version** (e.g. 1.84.x): v3.2.4  
**What are you trying to achieve?:**

I created a stroop experiment on psychopy builder, but I need to add feedback that is contingent on the person’s response. Basically, participant responds within 5 seconds using the keyboard, and then after 0.5 seconds, text on the screen will say ‘correct’ or ‘try again’ depending on whether the participant got the answer right. After the feedback, the trial starts with new stimuli, and the timer clock resets.

How can I go about doing this?

Thank you.

---

<div class="post-metadata">

**Author:** ![Michael](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/michael/32/16_2.png) [@Michael](https://discourse.psychopy.org/u/Michael)\
**Post date:** [December 3, 2019, 12:24am UTC](https://discourse.psychopy.org/t/feedback-contingent-on-response/10138/2 "2019-12-03T00:24:01Z")

</div>

Add a feedback routine after your other routine, and insert both a text component to give the feedback message, and a code component to decide what the feedback will be. Make sure the code component is above the text component. In the “begin routine” tab of the code component, put this:

```auto
if your_keyboard_component_name.corr:
    feedback = 'Correct'
else:
    feedback = 'Try again'

```

In the text component, put `$feedback` in the text field, and set it to update “every repeat”.

---

<div class="post-metadata">

**Author:** ![Evi\_Myftaraj](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/evi_myftaraj/32/6405_2.png) [@Evi\_Myftaraj](https://discourse.psychopy.org/u/Evi_Myftaraj)\
**Post date:** [December 3, 2019, 12:52am UTC](https://discourse.psychopy.org/t/feedback-contingent-on-response/10138/3 "2019-12-03T00:52:01Z")

</div>

Thank you so much!
