Question: 1. Write a program to request the user enter a desired number of values. Create a loop to load the desired number of user-specified values

 1. Write a program to request the user enter a desirednumber of values. Create a loop to load the desired number of

1. Write a program to request the user enter a desired number of values. Create a loop to load the desired number of user-specified values into a list. Create two lists with the same values but generated in different ways. One list will be originally initialized to have the desired length before entering the loop and values placed at the appropriate index position cach time through the loop. The other list will begin empty and values appended for every iteration of the loop. Output fro m the program shoul d appear as follows: How many values do you want? !5 Enter val #1: 5 Enter val #2: 4 Enter val #3 : 3 Enter val #4: 2 Enter val #5: 1 The first list is [5.0, 4.0, 3.0, 2.0, 1.0] The second list is [5.0, 4.0, 3.0, 2.0, 1.0] 2. Using the numpy.random.rand command, create a 5x4 array of random values. Display the array and the row/col position of the maximum value using the numpy.where command. Output should look like: Row of largest value is xxx Column of largest value is xxx 3. Use the matplotlib.image.imread command to load the stinkbug.png file, which returns a NumPy array containing floats. The array is 375 rows by 500 columns because the image resolution is 500x375 pixels, and the grayscale pixel values vary between 0 and 1. Without using a built-in function, manually create a histogram by looping through 20 equally spaced intervals between 0 and 1 and finding the number of image pixels in each range. Display the grayscale image using the matplotlib.image.imshow command by setting the cmap input argument to 'gray' (below left). Then use the matplotlib.pyplot.bar command to display the histogram (below right) Note that the default width of 0.8 will be too large for this case

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 Databases Questions!