Write a function is_decreasing_number(n: int) -> bool that checks if a given 4-digit number is decreasing, meaning each digit is strictly less than the digit before it (from left to right).
The function should return True if the number meets the criteria and False otherwise.
The input number will be a 4-digit number, which means it will be in the range of 1000 to 9999.
>>> is_decreasing_number(4321)
True
>>> is_decreasing_number(4312)
False
>>> is_decreasing_number(9876)
True
>>> is_decreasing_number(1111)
False
>>> is_decreasing_number(3210)
True
Implement this function:
def is_decreasing_number(n: 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: n.
Input
4321
Output
True
Write a function is_decreasing_number(n: int) -> bool that checks if a given 4-digit number is decreasing, meaning each digit is strictly less than the digit before it (from left to right). The function should return True if the number meets the criteria and False otherwise. ### Constraints The input number will be a 4-digit number, which means it will be in the range of 1000 to 9999. ### Example ``` >>> is_decreasing_number(4321) True >>> is_decreasing_number(4312) False >>> is_decreasing_number(9876) True >>> is_decreasing_number(1111) False >>> is_decreasing_number(3210) True ``` ## Your task Implement this function: ```python def is_decreasing_number(n: 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: `n`. ## Example **Input** ``` 4321 ``` **Output** ``` True ``` Write a function solve_for_x(equation: str) -> float that takes a string representing a linear equation in the form ax+b=c or ax-b=c, where a, b, and c are integers. The function should return the value of x as a float. The equation will always follow the correct format, which is: a and b are integer coefficients (they can be positive or negative) and are optional. x is the variable will always be there before the =.\ The equality sign and c will always present be present.\ If their is no coefficient for x it is assumed to be 1.\ The equation might have spaces inbetween or in the end, which have to be ignored. Hint: Think of x and = as separators. ### Example ``` >>> solve_for_x("2x +3= 11") 4.0 >>> solve_for_x("5x -2 = 13") 3.0 >>> solve_for_x("-3x + 10=1") 3.0 >>> solve_for_x("x + 2 = 5") 3.0 >>> solve_for_x("2x=6") 3.0 ``` ## Your task Implement this function: ```python def solve_for_x(equation: str) -> float: ``` 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: `equation`. ## Example **Input** ``` "2x +3= 11" ``` **Output** ``` 4.0 ``` Write a function divide_into_almost_equal_parts(n: int, k: int) -> list that takes two integers, n and k, and creates a list of size k where the elements are approximately equal and sum up to n. The list should contain larger numbers towards the beginning. The larger numbers should be prioritized for the earlier parts of the list, and you should ensure that the sum of the list matches n. ### Constraints The integers n (total) and k (parts) are both positive integers. The output list will always be of length k. 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 ``` >>> divide_into_almost_equal_parts(5, 3) [2, 2, 1] >>> divide_into_almost_equal_parts(16, 3) [6, 5, 5] >>> divide_into_almost_equal_parts(12, 4) [3, 3, 3, 3] >>> divide_into_almost_equal_parts(10, 3) [4, 3, 3] ``` ## Your task Implement this function: ```python def divide_into_almost_equal_parts(n: int, k: int) -> list: ``` 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: `n`, `k`. ## Example **Input** ``` 5 3 ``` **Output** ``` [2, 2, 1] ```