Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions arrays_beyza_saridas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import numpy as np

def replace_center_with_minus_one(d, n, m):
if m > n:
raise ValueError(" m should be less than or equal to n")
if d <= 0:
raise ValueError(" d should be greater than 0")
if n < 0:
raise ValueError(" n should be greater than 0")
if m < 0:
raise ValueError(" m should be greater than 0")

an_array = np.random.randint(0, 10 ** d, size=(n, n))
print(an_array)

start_idx = (n - m) // 2
end_idx = start_idx + m

an_array[start_idx:end_idx, start_idx:end_idx] = -1

print(an_array)
return an_array