input: Write a python function to generate a random password of a given length containing both letters and digits.
  assert len(get_password(7)) == 7
  assert len(get_password(10)) == 10
  assert any(char.isdigit() for char in get_password(7))
  assert any(char.isalpha() for char in get_password(7))
output: import random
  import string
  
  def get_password(length):
      if length < 1:
          return ""
      characters = string.ascii_letters + string.digits
      password = ''.join(random.choice(characters) for _ in range(length))
      while not any(char.isdigit() for char in password) or not any(char.isalpha() for char in password):
          password = ''.join(random.choice(characters) for _ in range(length))
      return password