Final answer:
The function high_score consumes a list of integers and returns the highest score, ignoring scores less than 100 and stopping when -999 is encountered.
Step-by-step explanation:
The function high_score takes a list of integers as input and returns the highest score in the list. It disregards any scores that are less than 100 and stops processing values if it encounters -999. If the list is empty, it returns None instead.
Here's an example implementation of the high_score function in Python:
def high_score(scores):
highest_score = None
for score in scores:
if score == -999:
break
if score >= 100:
if highest_score is None or score > highest_score:
highest_score = score
return highest_score
The function initializes max_score as None.
It iterates through the list, updating max_score if a valid score (greater than or equal to 100) is encountered.
If -999 is encountered, the loop breaks and the function returns the highest valid score found.
If the list is empty, the function returns None.
This function provides a flexible and efficient way to find the highest score in a list, considering the specified conditions.