input: Write a function to generate a Python code that converts a given number into its binary format as a string. The function should return '0' if the input number is 0. If the input number is not 0, the function should determine its binary representation by finding the remainders of the number when divided by 2 and reversing the order of remainders to form the binary string.
  
  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
  
  # assert test cases
  assert convert_to_binary(0)=='0'
  assert convert_to_binary(1)=='1'
  assert convert_to_binary(2)=='10'
  assert convert_to_binary(5)=='101'
  assert convert_to_binary(10)=='1010'
  
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