Creating a variable for an object

I am trying to create a camera follow script that will follow any object that is set as its target variable, however it will not allow me to assign a variable as an object initially. From what I can tell the problem arises when I use the Find(“”) function to get the object, and I don’t know what “as” type the variable should be. Is there any way I can get the variable to be set at runtime? Thanks in advance, here is the code:

target = gameObject.Find("Biplane")

	def Update ():
		transform.position.x = target.transform.position.x
		transform.position.y = target.transform.position.y

The error report says that “target” is “null” when it is called on Update()

Im fairly new to unity coding so don’t take my word for it, perhaps make a

var target:GameObject; 

then include

function Start(){
target=gameObject.Find("Biplane");
} 

thats usually how i get past these things