Программа:
Python:
arr = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
for i in range(len(arr)):
if arr[i] > 0: arr[i] = 1
if arr[i] < 0: arr[i] = -1
print(arr)
Программа:
Python:
arr = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
for i in range(len(arr)):
if arr[i] > 0: arr[i] = 1
if arr[i] < 0: arr[i] = -1
print(arr)