Question: Write a program that asks users for output file name to save the following image. A sample run of the program: Enter output file name:
Write a program that asks users for output file name to save the following image. A sample run of the program:
Enter output file name: shape_6.png
Hint: Here's a way to approach the problem:
Create a 3D array with 30 x 30 x 3 using numpy.
Set background color to be yellow, which is a combination of red and green.
The left vertical line runs from 3 (included) to 26 (not included) in vertical direction, that is, height, and from 4 (included) to 7 (not included) in horizontal direction, that is, width. Color is blue.
The middle horizontal line runs from 13 (included) to 16 (not included) in vertical direction, that is, height, and from 4 (included) to 26 (not included) in horizontal direction, that is width.
The bottom horizontal line runs from 24 (included) to 27 (not included) in vertical direction, that is, height, and from 4 (included) to 26 (not included) in horizontal direction, that is, width.
The right vertical line runs from 15 (included) to 27 (not included) in vertical direction, that is, height, and from 23 (included) to 26 (not included) in horizontal direction.
Enter an output file name and save it.
Remove any imshow or show statement of plt before submission.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
