def create_category(info_str):
    """
    param: info_str (string) is expected to contain two
            space-separated items:
            a category name (ideally, a single word)
            and its numeric grade weight.
    The function splits the input string and validates its
    components (see the errors and helper functions).

    return:
    If the validation passes, return a new dictionary with
    the following string keys are assigned to the values that
    were extracted from the info_str parameter:
    - category - the name of each grade category (string)
    - weight - the percentage weight of the category (float)
    - grades - an empty list (for storing future grades)
    Example: an input string "Quiz 25" results in a dictionary
    { 'category': 'Quiz', 'weight': 25.0, 'grades': [] }

    Errors:
    If any of the errors occur, a new dictionary is not created.
    If info_str.split() does not result in a two-element list,
    then return -2.
    If a category name is less than 2 characters or contains a
    comma, then return -1.
    If the weight (the percentage) in info_str is not numeric
    (int or float), return 0.

    Helper functions:
    The function calls the following helper functions:
    - is_num() to verify that the weight is a numeric value.
    """
    def is_num(info_str):
        """
        param: info_str (string)
        The function returns True if the input string is
        numeric (int or float), and False otherwise.
        """
        return info_str.isdigit()
    # using Boolean value as a flag to know whether to run through the loop again
    # working with dictionaries stored inside a list (a nested list) - using append()
    # creating a new dictionary and its elements
    # formatting the output according to the specifications
    category = info_str.split()
    if len(category) != 2:
        return -2
    elif len(category[0]) < 2 or ',' in category[0]:
        return -1
    elif not is_num(category[1]):
        return 0
    info_list = {'category': category[0], 'weight': float(category[1]), 'grades': []}
    return info_list