Modifying an array

Report a typo

Given below is an array of integer numbers:

a = [9, 8, 3, 1, 5, 4]

Assume we apply the following procedure for the array:

for (i = 0; i < len(a); i = i + 1):
    if a[i] % 2 == 0 then:
        a[i] += 1
    else:
        a[i] -= 1

What is the state of the array after the procedure is completed? Print all elements of the array separated by spaces in the field below. For example, your output may look like this:

7 3 1 5 4 2
Enter a short text
___

Create a free account to access the full topic