hi ,
first you have to arrange the code , tabs and spaces are important in python , and the main problem in your code is == , == is used when you want to compare 2 values without assigning a new value , if you want to assign value use = .
also I prefer to define obj as :
obj = op.GetObject()
----------
op is the python tag and I am referring to the object that have the python tag so when you change the object you want ,or change the name of it your script will still work .
this is this a working code (prefer to change obj to obj =op.GetObject()
import c4d
def main():
obj= doc.SearchObject('Null')
if obj[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y]<0: # i just dragged the y position in the script editor #
obj[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y]=0
elif obj[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y]>200:
obj[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y]=200