1.

Write a code to plot the speed of a passenger train as shown in the figure given below:

Answer»

import matplotlib.pyplot as plt

import numpy as np

x = np.arange(1, 5)

plt.plot(x, x*1.5, label='Normal')

plt.plot(x, x*3.0, label='Fast')

plt.plot(x, x/3.0, label='Slow')

plt.legend()

plt.show()



Discussion

No Comment Found

Related InterviewSolutions