Write a function div_by_exactly_one that takes three integers num, a, and b. The function should return True if num is divisible by exactly one of the numbers a or b, and False otherwise.
NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.
Examples:
num=20, a=5, b=6 --> True (20 is divisible by 5 only)num=20, a=5, b=10 --> False (20 is divisible by both 5 and 10)num=20, a=6, b=10 --> True (20 is divisible by 10 only)num=20, a=6, b=7 --> False (20 is not divisible by either 6 or 7)Implement this function:
def div_by_exactly_one(num: int, a: int, b: int) -> bool:
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: num, a, b.
Input
20
5
6
Output
True
Write a function `div_by_exactly_one` that takes three integers `num`, `a`, and `b`. The function should return `True` if `num` is divisible by exactly one of the numbers `a` or `b`, and `False` otherwise. **NOTE:** This is a function type question, you don't have to take input or print the output, just have to complete the required function definition. **Examples:** - `num=20, a=5, b=6` --> `True` (20 is divisible by 5 only) - `num=20, a=5, b=10` --> `False` (20 is divisible by both 5 and 10) - `num=20, a=6, b=10` --> `True` (20 is divisible by 10 only) - `num=20, a=6, b=7` --> `False` (20 is not divisible by either 6 or 7) ## Your task Implement this function: ```python def div_by_exactly_one(num: int, a: int, b: int) -> bool: ``` Write the function only — the arguments are read for you and the return value is printed automatically. **Arguments** arrive as one Python literal per line, in this order: `num`, `a`, `b`. ## Example **Input** ``` 20 5 6 ``` **Output** ``` True ``` Convert a date string from the format `mm-dd-yy` to `yy-dd-mm`. **NOTE:** This is a function type question, you don't have to take input or print the output, just have to complete the required function definition. ### Example ``` Input: "12-25-21" Output: "21-25-12" ``` ## Your task Implement this function: ```python def mm_dd_yy_to_yy_dd_mm(date: str) -> str: ``` Write the function only — the arguments are read for you and the return value is printed automatically. **Arguments** arrive as one Python literal per line, in this order: `date`. ## Example **Input** ``` '12-25-21' ``` **Output** ``` '21-25-12' ``` Write a function `increment_value_with_max_limit` that increments the value for a specified key in a dictionary by a given increment value (`inc`). However, the value should not exceed a specified maximum limit (`limit`). Assume the dictionary values are integers. If the resulting value after incrementing is greater than the limit, it should be capped at the limit. **NOTE:** This is a function type question, you don't have to take input or print the output, just have to complete the required function definition. ### Example ```python >>> d = {"x": 5, "y": 3, "z": 5} >>> key, inc, limit = "y", 5, 5 >>> increment_value_with_max_limit(d, key, inc, limit) >>> d {"x": 5, "y": 5, "z": 5} # 3+5=8 but max limit is 5 >>> increment_value_with_max_limit(d, "z", 5, 11) >>> d {"x": 5, "y": 5, "z": 10} # 5+5=10 less than limit >>> increment_value_with_max_limit(d, "x", 5, 4) >>> d {"x": 4, "y": 5, "z": 10} # capped at the limit 4 ``` ## Your task Implement this function: ```python def increment_value_with_max_limit(d: dict, key: str, inc: int, limit: int): ``` Write the function only — the arguments are read for you and the return value is printed automatically. **Arguments** arrive as one Python literal per line, in this order: `d`, `key`, `inc`, `limit`. ## Example **Input** ``` {'x': 5, 'y': 3, 'z': 5} 'y' 5 5 ``` **Output** ``` {'x': 5, 'y': 5, 'z': 5} ```