input: Write a function to convert a given sentence into Morse code using the provided Morse code dictionary. The function should return a string of Morse code where each character in the sentence is replaced by its corresponding Morse code and characters are separated by spaces. If the given sentence is empty, return an empty string as well.
  def encode(message):
   code = ''
   for letter in message:
    code += MORSE_CODE[letter.upper()] + ' '
   
   return code
  
  assert encode("Hello world")==".... . .-.. .-.. ---  .-- --- .-. .-.. -.."
  assert encode("Python")==".--. -.-- - .... --- -."
  assert encode("123")==".---- ..--- ...--"
  assert encode("SOS")=="... --- ..."
  assert encode("")==""
output: def encode(message):
      MORSE_CODE = {
          'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....',
          'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.',
          'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-',
          'Y': '-.--', 'Z': '--..', '1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....',
          '6': '-....', '7': '--...', '8': '---..', '9': '----.', '0': '-----', ' ': ' '
      }
      code = ''
      for letter in message:
          code += MORSE_CODE[letter.upper()] + ' '
      return code.strip()