Draws a Step Function
Starts at (0,0): n = number of steps to be drawn l = length of each step segment u = vertical jump
Modules used: math, pyplot
from math import * from matplotlib.pyplot import * # PLOT STEPS # Edward Shore 4/5/2026 # Numworks n=eval(input("# of steps? ")) l=eval(input("length? ")) u=eval(input("jump? ")) # initialize x=[] y=[] t=0 # build for i in range(n): x.append(t) y.append(i*u) t+=l x.append(t) y.append(i*u) axis((-2,n*l+2,-2,n*u+2)) axis("on") for i in range(0,2*n,2): x1=[x[i],x[i+1]] y1=[y[i],y[i+1]] plot(x1,y1,color='red') show()