← back to unit
Easy
# searching easy
Count the Positives and Negatives
The mountain weather station logs temperatures above AND below freezing. 🏔️
You get a list of temps. Count the positive ones and the negative ones (zero counts as neither). Print the positive count, a space, then the negative count.
Example:
Input: temps = [5, -3, 0, 8, -1]
Output: 2 2
5 and 8 are positive (2 of them); -3 and -1 are negative (2 of them); 0 counts as neither — print 2 2.
💡 need a hint?
srch-pos-neg-count.py🔒 given lines are locked — write your code in between
loading...