Given an array A (n). Replace the positive elements of the array by their sum, and decrease

Given an array A (n). Replace the positive elements of the array by their sum, and decrease the negative elements by the minimum.

The solution to the problem is provided in a programming language such as Python 3.6.1.

Let’s create an empty array, where we will add n-th number of elements one by one.

Next, using the for loop, we find the sum of all positive numbers in the array and the minimum negative one.

Then, again, using a for loop, replace the positive elements of the array with their sum, and the negative ones with the minimum negative number.

n = int (input ())
A = []
for i in range (n):
b = int (input ())
A.append (b)
b = 0
min = 0
for i in range (n):
if A [i]> 0:
b + = A [i]
elif A [i] <0:
if A [i] <min:
min = A [i]
for i in range (n):
if A [i]> 0:
A [i] = b
elif A [i] <0:
A [i] = min
print (A)



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.