Your question is Decimal to Binary Coding. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
In a Birlasoft QA automation utility, numeric values may need to be represented in binary for validation and low-level test checks. Given a non-negative decimal integer, return its binary representation as a string without using Python's built-in base-conversion functions such as bin().
Implement decimal_to_binary(n), where n is an integer greater than or equal to zero. Return a string containing the binary digits of n, with no leading zeroes except that zero itself must return "0".
Use repeated division by two: the remainder from each division is the next binary digit, starting from the least significant digit. Reverse the collected remainders before returning the result.
def decimal_to_binary(n):