"""
CSCI 145 Day 9 - more lists

Part 1: Map, filter, and reduce with loops.
Part 2: Map and filter again, as list comprehensions.
Bonus: double_in_place.
Test your functions with the calls at the bottom once you're done.
"""


# ---------- Part 1: loops ----------

def lengths(words):
    """
    Return a list of the length of each string in words, in order.

    If words is not empty, returns one length per word.
    Otherwise, returns [].

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


def long_words(words, min_len):
    """
    Return a list of the strings in words that have at least min_len
    characters, in their original order.

    If some words have at least min_len characters, returns a list of them.
    Otherwise, returns [].

    Params:
        words (list of str) -- the words to check
        min_len (int) -- the fewest characters a word can have
    Returns: list of str
    """
    # your code here


def product(nums):
    """
    Return all the numbers in nums multiplied together.

    If nums is not empty, returns the product of its numbers.
    Otherwise, returns 1.

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


# ---------- Part 2: list comprehensions ----------

def lengths_comp(words):
    """
    Same as lengths, but the body is one line:
    return a list comprehension.

    If words is not empty, returns one length per word.
    Otherwise, returns [].

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


def long_words_comp(words, min_len):
    """
    Same as long_words, but the body is one line:
    return a list comprehension.

    If some words have at least min_len characters, returns a list of them.
    Otherwise, returns [].

    Params:
        words (list of str) -- the words to check
        min_len (int) -- the fewest characters a word can have
    Returns: list of str
    """
    # your code here


def double_in_place(nums):
    """
    Bonus: double every number in nums by changing the list itself.
    Don't build a new list, and don't return anything.

    If nums is not empty, each item becomes twice its old value.
    Otherwise, nums stays [].

    Params: nums (list of int) -- the list to change
    Returns: None
    """
    # your code here


words = ["fig", "banana", "kiwi", "cherry"]
print(lengths(words))               # [3, 6, 4, 6]
print(lengths([]))                  # []
print(long_words(words, 5))         # ['banana', 'cherry']
print(long_words(words, 10))        # []
print(product([2, 3, 4]))           # 24
print(product([]))                  # 1
print(lengths_comp(words))          # [3, 6, 4, 6]
print(long_words_comp(words, 5))    # ['banana', 'cherry']
nums = [1, 5, 10]
double_in_place(nums)
print(nums)                         # [2, 10, 20]
