Error in Spyder: States variable is undefined, program still runs
0
$begingroup$
I recently received the following code to work with: import seawater as sw import matplotlib.pyplot as plt def getPlotVars(): print("how many plots do you want to make?") numPlots = input() varName = for i in range(int(numPlots)): print("what variable do you want to plot against depth (Choose from: s, t, p, d) for plot number " + str(i+1) + "?") varName.append(input()) return varName #return saves the result of the function to be utilized elsewhere def plotVar(var, depths, figNum, xlabel): plt.xlabel(xlabel, fontsize=15) plt.ylabel("Depth (m)", fontsize=15) plt.title(str(xlabel)+"vs Depth (m)", fontsize=20) plt.gca().invert_yaxis() plt.plot(var,z) plt.show() def main(...