Check your understanding of the previous reading: nested indexing, the types of a nested list and its parts, and nested loop patterns.
Given the following code...
def beta(values: list[int]) -> int:
result = values[0]
for value in values:
if value > result:
result = value
return result
def alpha(values: list[list[int]]) -> int:
result = beta(values[0])
for row in values:
beta_row = beta(row)
if beta_row < result:
result = beta_row
return result
grades = [
[90, 99, 95],
[75, 50, 60],
[80, 90, 100]
]
What value will be produced when the expression alpha(grades) is evaluated?
beta is the Max pattern: it returns the highest value of one row. alpha is the Min pattern over the rows, comparing each row's beta result: the row maximums are 99, 75 and 100, and the smallest of those is 75.