Experiment crashing before it begins

I have written this code to attempt to get a particular video to play, depending on the reaction time (time taken to press the space bar). The experiment crashes before it even begins, (Alert 4205:Python Syntax Error in ‘End Routine’ tab. See 'if rounded_space_bar = 0.5:
’ on line number 4 of the ‘End Routine’ tab.) I am new to this, so apologies if this seems like a trivial question!

rounding the space bar reaction times (RT) to the nearest 0.5 seconds.

rounded_space_bar = round(space_bar.rt)

selecting particular videos, depending on the RT.

if rounded_space_bar = 0.5:
video_selected = Adobe_videos/0.5_video.mp4
elif rounded_space_bar = 1.0:
video_selected = Adobe_videos/1.0_video.mp4
else:
video_selected = Adobe_videos/1.5_video.mp4

Conditional statements require == not =.

= change the value of something

== checks if one thing is the same as another.

Hello Molly,

first, please surround code with triple ` such that it is properly formatted here. Second, an if-construction in Python is written

if condition == some_value:
   do something

So replace your single = in your if-construction with a **==*.

Best wishes Jens

Hi Jens,

Thank-you for the help! It is still saying I have a Syntax error. Where am I going wrong?

 # rounding the space bar reaction times (RT) to the nearest 0.5 seconds.
rounded_space_bar = round(space_bar.rt)
# selecting particular videos, depending on the RT.
if rounded_space_bar == 0.5:
    video_selected = Adobe_videos/0.5_video.mp4
elif rounded_space_bar == 1.0:
    video_selected = Adobe_videos/1.0_video.mp4
else:
    video_selected = Adobe_videos/1.5_video.mp4

Hello Molly,

surround the videofile-path and name with ", e.g.

# rounding the space bar reaction times (RT) to the nearest 0.5 seconds.
rounded_space_bar = round(space_bar.rt)
# selecting particular videos, depending on the RT.
if rounded_space_bar == 0.5:
    video_selected = "Adobe_videos/0.5_video.mp4"
elif rounded_space_bar == 1.0:
    video_selected = "Adobe_videos/1.0_video.mp4"
else:
    video_selected = "Adobe_videos/1.5_video.mp4"

Best wishes Jens

Thank-you so much that worked!