Need assistance! I am having trouble with the code in python C4_W1_Lab 1

Hello everyone,
I am having some trouble with Lab 1, perhaps it is the way that I typed in python.
I kept getting the following error : “Traceback (most recent call last):
File “<pyshell#50>”, line 1, in
plot_series(time, series)
NameError: name ‘time’ is not defined”
Please see below the structure of the code :

def plot_series(time, series, format=“-”, start=0, end=None, label =None):
plt.plot(time[start:end], series[start:end], format, label=label)
plt.xlabel(“Time”)
plt.ylabel(“Value”)
if label :
plt.legend(fontsize=14)
plt.grid(True)
def trend(time, slope=0):
return slope * time
time = np.arange(4 * 365 +1)
baseline = 10
series = trend(time, 0.1)

plt.figure(figsize=(10, 6))

   <Figure size 1000x600 with 0 Axes>

plot_series(time, series)
Traceback (most recent call last):
File “<pyshell#50>”, line 1, in
plot_series(time, series)
NameError: name ‘time’ is not defined
I will appreciate any clarity. I am a bit new to python. In terms of time series my baptism was through R-program

Maybe it’s just an artifact of pasting here, but your code looks left justified, which would be consistent with the error message. Every line that you want included in a defined function needs to be indented. When other control structures, such as the if… are used, the lines following them require additional indentation.

See the examples in the linked Python doc.

Which course are you attending? I don’t recognize that code as belonging in the Deep Learning Specialization - Course 4.