1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
german
3 years ago
9

Write a code that makes a 2D square array with 20×20 elements. Fill the array with random numbers initially. Then, "draw" a squa

re in the array by adding a value of 4 to those array elements, and plot it with imshow. The square should be centered and have side lengths of 10 .
Computers and Technology
1 answer:
NemiM [27]3 years ago
4 0

Answer:

Answer explained below. Python language used

Explanation:

The size of the square is of size 10. So assuming zero indexing,

vertical side1 (column Index = 5): row index from 5 to 14

vertical side1 (column Index = 14): row index from 5 to 14

horizontal side1 (row Index = 5): column index from 5 to 14

horizontal side2 (row Index = 14): column index from 5 to 14

Note:

while indexing, data_new[a:b,c] denotes,

row index: a to b-1

column index: c

Similarly data_new[a,b:c] denotes,

row index: a

column index: b to c-1

<u>Code: </u>

import matplotlib.pyplot as plt

import numpy as np

size_1 = 20

size_2 = 20

data_new = np.random.random((size_1,size_2))

data_new[5:15,5] = 4

data_new[5:15,14] = 4

data_new[5,5:15] = 4

data_new[14,5:15] = 4

fig = plt.figure(figsize=(10,10))

plt.imshow(data_new)

plt.colorbar()

plt.show()

You might be interested in
Which role is delegated to personnel of the IT department and is responsible for maintaining the integrity and security of the d
enyata [817]

Correct question.

Which role is delegated to personnel of the IT department and how is responsible for maintaining the integrity and security of the data?

Answer:

<u>data custodian</u>

<u>Explanation:</u>

Remember, every organization generates data, and large organizations generate even larger data.

Hence, the role of a data custodian in an organization requires He implements measures to protect the organization's data, store and backup the data, as well as granting access to the data to authorized persons when needed.

3 0
2 years ago
A person you respect who offers you advice and assistance is known as a(n) _____.
Archy [21]
This would be a mentor-D. They role is to mentor or guide you with advice or assistance. A role model is a similar answer in that they respect you, but they might not offer advice or assistance which makes it incorrect.
7 0
2 years ago
Programmers use an Integrated Development Environment (IDE) to write software programs, because:
Natali [406]

Answer:

A) It simplifies the process by providing a single user interface for multiple software tools.

Explanation:

6 0
2 years ago
Consider the following methods:
il63 [147K]
<span>2. basketball This is a classic case of overloading in C++. You have 2 functions, both named "printSport", but one of the functions receives an input of type double, and the other receives an input of type int. The specified method call passes a parameter of type int, so the version of printSport is called that receives a parameter of type int. And that version of printSport only prints the word "basketball". The other version of printSport is never called at all.</span>
4 0
3 years ago
How do i switch my level to high school on brainly
Bumek [7]

Edit your profile, click preferences, and then there should be a drop down that has your level on it which you can change.

7 0
2 years ago
Read 2 more answers
Other questions:
  • If you want to present slides to fellow students or co-workers, which productivity software should you use to create them?
    5·2 answers
  • What is faster a hi-speed usb port or superspeed usb port?
    13·1 answer
  • If you decide to get married, a trade-off would be that you have to give up being single.
    12·2 answers
  • what is a massive online storage that allows for Access by any internet-connected device running web browser. use for Less priva
    6·1 answer
  • Select the best word or phrase to complete each sentence Jobs that require you to use your v are typically rewarding Individuals
    12·1 answer
  • (PYTHON HOMEWORK)Given the following code snippet, which statement tests to see if all three sets are equal?:
    11·1 answer
  • How to cancel branly subscription??​
    8·1 answer
  • Computer privacy typically occurs when which of the following is violated?
    6·1 answer
  • What is the result of the following code?<br><br> x=7//2+10%2**4<br><br> print(x)
    15·1 answer
  • This ingredient is often used as decoration for both hot and cold dessert​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!