Write a function product_of_sum_and_abs_diff_of_digits(num) that takes a two-digit number (it may be negative, then ignore the sign) and returns the product of the sum of its two digits and the absolute difference of its two digits.
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.
product_of_sum_and_abs_diff_of_digits(54) -> 9
product_of_sum_and_abs_diff_of_digits(38) -> 55
Implement this function:
def product_of_sum_and_abs_diff_of_digits(num: int) -> 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: num.
Input
54
Output
9
Write a function `product_of_sum_and_abs_diff_of_digits(num)` that takes a two-digit number (it may be negative, then ignore the sign) and returns the product of the sum of its two digits and the absolute difference of its two digits. 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 ``` product_of_sum_and_abs_diff_of_digits(54) -> 9 product_of_sum_and_abs_diff_of_digits(38) -> 55 ``` ## Your task Implement this function: ```python def product_of_sum_and_abs_diff_of_digits(num: int) -> 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: `num`. ## Example **Input** ``` 54 ``` **Output** ``` 9 ``` Write a function `is_divisible_by_last_two_digits(num)` that returns `True` if the positive integer `num` is divisible by each of its last two digits (the units digit and the tens digit). If either of these two digits is `0`, return `False`. 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 ``` is_divisible_by_last_two_digits(1236) -> True is_divisible_by_last_two_digits(345) -> False ``` ## Your task Implement this function: ```python def is_divisible_by_last_two_digits(num: 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`. ## Example **Input** ``` 1236 ``` **Output** ``` True ``` The values of the dictionary `d` are non-empty strings. Write a function `swap_last_chars_of_values(d, k1, k2)` that swaps the last character of the value at key `k1` with the last character of the value at key `k2`. The function changes `d` itself and returns nothing. 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 ``` swap_last_chars_of_values({"first": "apple", "second": "mango", "third": "banana"}, "first", "second") -> {'first': 'applo', 'second': 'mange', 'third': 'banana'} swap_last_chars_of_values({"key1": "hello", "key2": "world"}, "key1", "key2") -> {'key1': 'helld', 'key2': 'worlo'} ``` ## Your task Implement this function: ```python def swap_last_chars_of_values(d: dict, k1, k2) -> None: ``` Write the function only — the arguments are read for you and the argument you change is printed automatically. **Arguments** arrive as one Python literal per line, in this order: `d`, `k1`, `k2`. ## Example **Input** ``` {"first": "apple", "second": "mango", "third": "banana"} "first" "second" ``` **Output** ``` {'first': 'applo', 'second': 'mange', 'third': 'banana'} ```