Solution:
def even_odd_count(num):
    """Given an integer. return a tuple that has the number of even and odd digits respectively.

     Example:
        even_odd_count(-12) ==> (1, 1)
        even_odd_count(123) ==> (1, 2)
    """
    even_count = 0
    odd_count = 0
    for digit in str(num):
        if digit.isdigit():
            if int(digit) % 2 == 0:
                even_count += 1
            else:
                odd_count += 1
    return even_count, odd_count


Solution:
def int_to_mini_roman(number):
    """
    Given a positive integer, obtain its roman numeral equivalent as a string,
    and return it in lowercase.
    Restrictions: 1 <= num <= 1000

    Examples:
    >>> int_to_mini_roman(19) == 'xix'
    >>> int_to_mini_roman(152) == 'clii'
    >>> int_to_mini_roman(426) == 'cdxxvi'
    """
    roman_numerals = {
        1: 'i',
        4: 'iv',
        5: 'v',
        9: 'ix',
        10: 'x',
        40: 'xl',
        50: 'l',
        90: 'xc',
        100: 'c',
        400: 'cd',
        500: 'd',
        900: 'cm',
        1000: 'm'
    }
    result = ''
    for value in sorted(roman_numerals.keys(), reverse=True):
        while number >= value:
            result += roman_numerals[value]
            number -= value
    return result.lower()


Solution:
def right_angle_triangle(a, b, c):
    '''
    Given the lengths of the three sides of a triangle. Return True if the three
    sides form a right-angled triangle, False otherwise.
    A right-angled triangle is a triangle in which one angle is right angle or
    90 degree.
    Example:
    right_angle_triangle(3, 4, 5) == True
    right_angle_triangle(1, 2, 3) == False
    '''
    return a**2 + b**2 == c**2 or a**2 + c**2 == b**2 or b**2 + c**2 == a**2


Solution:
def find_max(words):
    """Write a function that accepts a list of strings.
    The list contains different words. Return the word with maximum number
    of unique characters. If multiple strings have maximum number of unique
    characters, return the one which comes first in lexicographical order.

    find_max(["name", "of", "string"]) == "string"
    find_max(["name", "enam", "game"]) == "enam"
    find_max(["aaaaaaa", "bb" ,"cc"]) == ""aaaaaaa"
    """
    max_unique = 0
    max_word = ""
    for word in words:
        unique_chars = set(word)
        if len(unique_chars) > max_unique:
            max_unique = len(unique_chars)
            max_word = word
        elif len(unique_chars) == max_unique:
            if word < max_word:
                max_word = word
    return max_word


Solution:
def eat(number, need, remaining):
    """
    You're a hungry rabbit, and you already have eaten a certain number of carrots,
    but now you need to eat more carrots to complete the day's meals.
    you should return an array of [ total number of eaten carrots after your meals,
                                    the number of carrots left after your meals ]
    if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.

    Example:
    * eat(5, 6, 10) -> [11, 4]
    * eat(4, 8, 9) -> [12, 1]
    * eat(1, 10, 10) -> [11, 0]
    * eat(2, 11, 5) -> [7, 0]

    Variables:
    @number : integer
        the number of carrots that you have eaten.
    @need : integer
        the number of carrots that you need to eat.
    @remaining : integer
        the number of remaining carrots thet exist in stock

    Constrain:
    * 0 <= number <= 1000
    * 0 <= need <= 1000
    * 0 <= remaining <= 1000

    Have fun :)
    """
    return [number + need, remaining - need] if remaining >= need else [number + remaining, 0]


Solution:
def do_algebra(operator, operand):
    """
    Given two lists operator, and operand. The first list has basic algebra operations, and
    the second list is a list of integers. Use the two given lists to build the algebric
    expression and return the evaluation of this expression.

    The basic algebra operations:
    Addition ( + )
    Subtraction ( - )
    Multiplication ( * )
    Floor division ( // )
    Exponentiation ( ** )

    Example:
    operator['+', '*', '-']
    array = [2, 3, 4, 5]
    result = 2 + 3 * 4 - 5
    => result = 9

    Note:
        The length of operator list is equal to the length of operand list minus one.
        Operand is a list of of non-negative integers.
        Operator list has at least one operator, and operand list has at least two operands.

    """
    # Write your code here
    pass


Solution:
def solve(s):
    """You are given a string s.
    if s[i] is a letter, reverse its case from lower to upper or vise versa,
    otherwise keep it as it is.
    If the string contains no letters, reverse the string.
    The function should return the resulted string.
    Examples
    solve("1234") = "4321"
    solve("ab") = "AB"
    solve("#a@C") = "#A@c"
    """
    if not s:
        return s
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]
    if s.isalpha():
        return s.swapcase()
    if s.islower():
        return s.upper()
    if s.isupper():
        return s.lower()
    if s.isnumeric():
        return s[::-1]
    if s.isalnum():
        return s[::-1]


Solution:
def string_to_md5(text):
    """
    Given a string 'text', return its md5 hash equivalent string.
    If 'text' is an empty string, return None.

    >>> string_to_md5('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62'
    """
    if not text:
        return None
    return hashlib.md5(text.encode()).hexdigest()


Solution:
def generate_integers(a, b):
    """
    Given two positive integers a and b, return the even digits between a
    and b, in ascending order.

    For example:
    generate_integers(2, 8) => [2, 4, 6, 8]
    generate_integers(8, 2) => [2, 4, 6, 8]
    generate_integers(10, 14) => []
    """
    # Initialize an empty list to store the even digits
    even_digits = []

    # Iterate over the range from a to b (inclusive)
    for num in range(a, b + 1):
        # Check if the number is even
        if num % 2 == 0:
            # Append the even digit to the list
            even_digits.append(num)

    # Return the list of even digits
    return even_digits