Previous

Iteration

3 / 5
Next

A for loop can be used to go through each value of a list:

fruits = ['apple', 'banana', 'coconut']
for val in arr:
  print(val)

This prints all three fruits, each on its own line.

Send

List iteration

Hint
Beginner

Write a function maximum with a parameter arr, an array of ints. The function should return the maximum int in the list.

For example, if arr is [0, -2, 3, 1] then the function should return 3.

Help
Solve
Reset
Run
Submit
 

Test results

Test result #
Expected output
Your output

Your email has been verified!