How to create a simple enemy that moves vertically up and down

Hi all,

I am a student who has to create a simple game as part of an assignment. I really need help in creating and scripting an enemy that will move up and down causing difficulty for the player to jump from one platform to another.
I know it may be a simple request but so far I cannot find any help online.
I really would appreciate any help thanks

You really should be doing your homework on your own. But who am I to judge, I never did mine.

float maxMoveDistance = 10;
//Set this to your objects initial position when game starts.
Vector3 origin;
float speed = 10;

void Update(){
	Vector3 destination = origin;
	destination.y = (transform.position.y > origin.y + maxMoveDistance) ? origin.y : origin.y + maxMoveDistance;
	transform.position = Vector3.MoveTowards(transform.position, destination, speed * Time.deltaTime);

An alternative using MathF.PingPong:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {

    Vector3 _startingPos;
    Transform _trans;

    void Start() {
        _trans = GetComponent<Transform>();
        _startingPos = _trans.position;

    void Update() {
        _trans.position = new Vector3(_startingPos.x, _startingPos.y + Mathf.PingPong(Time.time, 3), _startingPos.z);