Human: square wave with input and end. Assistant: 
Here is a Python function to square wave with input and end

import numpy as np

def square_wave(x, period, amplitude, offset=0):
    """
    Returns a square wave with input and end
    """
    return (amplitude / 2) * (np.sign(np.sin(2 * np.pi * x / period)) + 1) + offset

# Enter the input
x = 0

# Enter the period
period = 1

# Enter the amplitude
amplitude = 1

# Enter the offset
offset = 0

# Calling the function
print((square_wave(x, period, amplitude, offset)))

#Example Output
# 0.5

#Remember to inspect code for bugs.