Question: In a new, empty . py file, write a program that imports the plot and show functions from matplotlib ( from pylab import plot, show

In a new, empty .py file, write a program that imports the plot and show functions from matplotlib (from
pylab import plot, show) and then import Pythons random module, which is part of the standard
library, via a the line: import random as rnd
Next, create a list of values called x_values which holds a list of 10 values going from 0 through to 9
these will be the horizontal values in our graph.
Now create a list of 10 random values within the range 1 to 100 called y_values. You can generate a
random value like this: rnd.randint(1,100). Dont forget you can use the append function on a list to add a
new value to the end of it!
Once you have 10 values each in your x_values and y_values lists, you can plot them like this:
plot(x_values, y_values)
show()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!