"""
CSCI 145 Day 7 - more iteration

Part 1: Loop over strings and build up a result with an accumulator.
Part 2: Ask the user for input, and generate a random arithmetic problem.
Test your functions with the calls at the bottom once you're done.
"""

import random


# ---------- Part 1: strings and accumulators ----------

def count_char(s, target):
    """
    Return how many times the character target appears in s.

    If target appears in s, returns the number of times it appears.
    Otherwise, returns 0.

    Params:
        s (str) -- the string to search
        target (str) -- a single character to count
    Returns: int
    """
    # your code here


def remove_spaces(s):
    """
    Return a copy of s with every space removed.

    If s contains spaces, returns s without them. Otherwise, returns
    s unchanged.

    Params: s (str) -- the string to copy
    Returns: str
    """
    # your code here


def has_double(s):
    """
    Bonus: check whether s has two identical characters next to each
    other, like the "ll" in "hello".

    If some character in s is the same as the character right after
    it, returns True. Otherwise, returns False.

    Params: s (str) -- the string to check
    Returns: bool
    """
    # your code here


# ---------- Part 2: input and random ----------

def ask_yes_no():
    """
    Ask the user "yes or no? " until they type exactly "yes" or "no".

    If the user types "yes" or "no", returns what they typed.
    Otherwise, prints "Please type yes or no." and asks again.

    Params: none
    Returns: str
    """
    # your code here


def random_problem():
    """
    Return a random arithmetic problem as a string, like "7 * 3":
    a random number from 1 to 10, a space, a random operator from
    "+-*", a space, and another random number from 1 to 10.

    Params: none
    Returns: str
    """
    # your code here


print(count_char("banana", "a"))     # 3
print(count_char("banana", "z"))     # 0
print(remove_spaces("hi there you")) # hithereyou
print(remove_spaces("cs145"))        # cs145
print(has_double("hello"))           # True
print(has_double("python"))          # False
print(random_problem())              # e.g. 7 * 3
print(random_problem())              # e.g. 2 + 10
print(ask_yes_no())                  # type maybe, then yes: prints yes
