"""
CSCI 145 Day 8 - lists

Part 1: Loop over a list.
Part 2: Build a new list with .append.
Test your functions with the calls at the bottom once you're done.
"""

PASSING = 60


# ---------- Part 1: loop over a list ----------

def count_passing(scores):
    """
    Return how many scores are at least PASSING.

    If some scores are PASSING or higher, returns how many.
    Otherwise, returns 0.

    Params: scores (list of int) -- the scores to check
    Returns: int
    """
    # your code here


def average(nums):
    """
    Return the average of the numbers in nums.

    If nums is not empty, returns its sum divided by its length.
    Otherwise, returns 0.0.

    Params: nums (list of int or float) -- the numbers to average
    Returns: float
    """
    # your code here


# ---------- Part 2: build a new list ----------

def squares(n):
    """
    Return a list of the squares of 1 through n, in order.

    If n is 1 or more, returns [1, 4, 9, ..., n * n].
    Otherwise, returns [].

    Params: n (int) -- the last number to square
    Returns: list of int
    """
    # your code here


def positives(nums):
    """
    Return a new list of the numbers in nums that are greater than 0,
    in their original order. nums itself does not change.

    If nums has numbers greater than 0, returns a list of them.
    Otherwise, returns [].

    Params: nums (list of int or float) -- the numbers to check
    Returns: list
    """
    # your code here


def longest_word(words):
    """
    Bonus: return the longest string in words, without using max().
    words has at least one string.

    If one string is longer than all the others, returns it.
    Otherwise, returns the first of the strings tied for longest.

    Params: words (list of str) -- the words to compare
    Returns: str
    """
    # your code here


print(count_passing([88, 45, 60, 72]))         # 3
print(count_passing([10, 20]))                 # 0
print(average([88, 92, 75, 100]))              # 88.75
print(average([]))                             # 0.0
print(squares(5))                              # [1, 4, 9, 16, 25]
print(squares(0))                              # []
print(positives([3, -1, 0, 8, -5]))            # [3, 8]
print(positives([-2, -7]))                     # []
print(longest_word(["fig", "banana", "kiwi"])) # banana
print(longest_word(["ab", "cd", "e"]))         # ab
