What does the pseudocode do

Report a typo

What is the result of the pseudocode function below?

function func(array):                 
    if len(array) == 0 then:      
        return -1            

    result = 0                  
    
    for i in [1, len(array)]: 
        result = result + array[i]
    
    return result / len(array)               

The input numbers are 1 2 3 4 5.

Note that in the pseudocode, array indexes start with 1

Enter a number
___

Create a free account to access the full topic