input: Write a function to convert a sentence to Morse code using the provided Morse code dictionary. If the given sentence is empty, return an empty string. The function should convert each letter in the sentence to its corresponding Morse code representation and return the concatenated Morse code string for the entire sentence, with spaces between Morse code characters for different letters.
  assert encode("Hello world")==".... . .-.. .-.. ---  .-- --- .-. .-.. -.."
  assert encode("")==""
  assert encode("SOS")=="... --- ..."
  assert encode("123")=".---- ..--- ...--"
  assert encode("Python")=".--. -.-- - .... --- -."
output: def encode(sentence):
      morse_code_dict = {
          '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': '--..', '0': '-----', '1': '.----', '2': '..---', '3': '...--', '4': '....-',
          '5': '.....', '6': '-....', '7': '--...', '8': '---..', '9': '----.', ' ': ' '
      }
      return ' '.join(morse_code_dict[char.upper()] for char in sentence if char.upper() in morse_code_dict)