Exercise: Highs and Lows
Separate highs from the lows and then count both.
We'll cover the following
Problem statement
Imagine you are analyzing a list of scores from a recent quiz. You are required to classify each score to determine how many are considered high
or low
. In this context, a score is categorised as high
if it is greater than 50
or divisible by 3
; otherwise, it is classified as low
.
You are required to implement the count_low_high()
function. Its parameter is a list of numbers. If a number is greater than 50
or divisible by 3
, it will count as a high
. If these conditions are not met, the number is considered a low
. At the end of the function, you must return a list that contains the count of lows and highs, in that order. In case the list is empty, you may return None
.
Sample input
Get hands-on with 1400+ tech skills courses.