Code
Multi-Safe
Help
1 2 3 4 5 6 7 8 9 10 11 12
numbers = [7, 14, 16, 9, 24, 30]
value1 = numbers[0]
value2 = numbers[2]
value3 = numbers[4]
code = [value1,value2,value3]
OUTPUT code
numbers = [18, 15, 6, 21, 32]
length = length(numbers)
value1 = numbers[0]
value2 = numbers[length-1]
code = [value1,value2,length]
OUTPUT code
list = [22, 10, 31, 19, 8, 17]

IF list[0]>list[1] THEN
   tmp = list[0]
   list[0] = list[1]
   list[1] = tmp
END IF

code = [list[0],list[1],list[2]]
OUTPUT code
set1 = [5, 10, 15, 20, 25, 30]
set2 = [3, 6, 9, 12, 15, 18]
code = []

FOR i FROM 0 TO 5
   IF i<3 THEN
     value = set1[i] + set2[i]
     code.append(value)
   END IF
NEXT i  

OUTPUT code
numbers = [17, 28, 6, 9, 32, 8, 35]
code = []

FOR i FROM 0 TO length(numbers)-1
    value = numbers[i]
    IF value MOD 2 == 1 THEN
       code.append(value)
    END IF
NEXT i	

OUTPUT code

______________________________________
Help: 
The MOD operator returns the remainder
of a division:
e.g.
7 MOD 3 = 1
numbers = [3, 12, 7, 23, 14, 11, 12]
code = []

FOR i FROM 0 TO length(numbers)-2
    IF numbers[i+1] > numbers[i] THEN
	   code.append(numbers[i+1])
    END IF
NEXT i	

OUTPUT code
array = [18, 12, 6, 9, 5, 34, 17]
code = []

FOR i FROM 2 TO 4
   value = array[i] * i
   code.append(value)
NEXT i

OUTPUT code
myList = [2,5,7,8,1,3,6,9,8]
code = []

FOR i FROM 0 TO 8 STEP 4
    code.append(myList[i])
NEXT i	

OUTPUT code
numbers = [7, 14, 6, 9, 24, 12]
code = []

FOR i FROM 5 TO 0 STEP -1
   IF i>2 THEN
      value = numbers[i] 
      code.append(value)
   END IF
NEXT i	

OUTPUT code
digits = [[7,8,9],[4,5,6],[1,2,3]]
code = []

FOR i FROM 0 TO 2
    code.append(digits[i][0])
NEXT i	

OUTPUT code
numbers = [[7,8,9],[4,5,6],[1,2,3]]
code = []

FOR i FROM 0 TO 2
    code.append(numbers[i][i])
NEXT i

OUTPUT code
numbers = [[7,8,9],[4,5,6],[1,2,3]]
code = []

FOR i FROM 0 TO 2
   value = 0
   FOR j FROM 0 TO 2
      value = value + numbers[i][j]
   NEXT j
   code.append(value)
NEXT i

OUTPUT code
In most high level programming languages, you can store a collection of values using either a list or an array.

e.g.
primeNumbers = [2, 3, 5, 7, 11, 13, 17, 19]

You can access any value of a list using a index to give the position of the value you would like to access. The first value of the list is at position 0.

e.g.
print(primeNumbers[0])
>>> Ouput 2

print(primeNumbers[1])
>>> Ouput 3

print(primeNumbers[2])
>>> Ouput 5

... and so on.

You can count how many items you have in a list using the length function:

e.g.
print(length(primeNumbers))
>>> Ouput 8

Hence you can easily access the last value of a list as follows:
print(primeNumbers[length(primeNumbers)-1])
>>> Ouput 19

You can create a 2D array (or a list of lists) as follows:
grid=[["X","X","O"],["O","X","O"],["X","O","O"]]

To access a value from this Noughts and Crosses grid, you will need to use two indices: one for the row number and one for the column.
e.g.
print(grid[0][0])
>>> Ouput X (top left corner of the grid)