# Author: Scott Wehrwein
# Date: 05/21/2025
# L17 Other practice problems

def charcount(in_string):
    """ Return a dictionary that maps each unique character in 
    in_string to the number of times it appears in the string.
    Precondition: in_string is a string
    Example: count("hahah") # => {"a": 2, "h": 3} """
    

def strmode(in_str):
    """ Return the most frequently-appearing character in   
    in_str, or any of the most frequent characters in case of a
    tie. Precondition: in_str is a string with nonzero length.
    Examples: strmode('hahah') # => 'h'
              strmode('who') # => could return 'w', 'h', or 'o'
    """
    
def dict_intersection(d1, d2):
    """ Return a dictionary containing only keys that appear in both d1 and d2.
    Each key's value is the sum of the corresponding values in d1 and d2.
    Example: dict_intersection({1: 2, 2: 3}, {2: -1, 3: 10}) => {2: 2}"""

  
def same_elements(list1, list2):
    """Return true if list1 and list2 contain exactly the same elements, possibly
    in a different order from each other. 
    Examples: same_elements([1, 2], [1, 2]) => True
            same_elements([1, 2], [2, 1]) => True
            same_elements([1, 2, 3], [2, 1, 3]) => True
            same_elements([1, 2], [2, 2]) => False
            same_elements([1, 1, 2], [2, 1, 1]) => True
            same_elements([1, 2, 2], [1, 1, 2]) => False
    Precondition: list1 and list2 are lists """
