Question: Write a program that creates a green 'T' logo for Thomas Hunter on a 30x30 grid. The grading script is expecting: The file to be

Write a program that creates a green 'T' logo for Thomas Hunter on a 30x30 grid.

The grading script is expecting:

  • The file to be saved as: logo.png.
  • The grid to be 30 x 30.
  • The 'T' to be 0% red, 100% green, and 0% blue. The top part of the 'T' should be the top third of the image and the bottom part of the 'T' should be the center third of the image.
  • The remaining pixels in the image should be white (100% red, 100% green, and 100% blue).

I'm getting error in this code. can anyone help me to fix it?

import matplotlib.pyplot as plt import numpy as np

#creating three sheets of 30x30 array logoImg = np.ones((30, 30, 3))

#setting green and blue channels of left 3rd of the image (between columns 0 and 10) to 0 logoImg[:,:10,1] = 0 logoImg[:,:10,2] = 0

#setting green and blue channels of right 3rd of the image (between columns 20 nd 30) to 0 logoImg[:,-10:,1] = 0 logoImg[:,-10:,2] = 0

#setting green and blue channels of bottom 3rd of the image (between rows 20 and 30) to 0 logoImg[-10:,:,1] = 0 logoImg[-10:,:,2] = 0

#saving image as logo.png plt.imsave("logo.png",logoImg)

Tests 30x30 'T' logo. (0.0/4.0)

Number of pixels that differed between your image and answer: 400.0. Test Failed: 400.0 != 0

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!