input: Write a function to convert a number into binary format by implementing the steps of dividing the number by 2 and concatenating the remainders in reverse order. If the input number is 0, return 0 directly.
  def convert_to_binary(num):
      if num == 0:
          return 0
      binary = ''
      while num != 0:
          remainder = num % 2
          binary = str(remainder) + binary
          num = num // 2
      return binary
  
  print(convert_to_binary(10))
  
  assert convert_to_binary(0) == 0
  assert convert_to_binary(1) == "1"
  assert convert_to_binary(2) == "10"
  assert convert_to_binary(10) == "1010"
  assert convert_to_binary(255) == "11111111"
output: def convert_to_binary(num):
      if num == 0:
          return 0
      binary = ''
      while num != 0:
          remainder = num % 2
          binary = str(remainder) + binary
          num = num // 2
      return binary