input: Write a python function to generate a random string of a given length using letters and digits.
  assert len(random_string(8)) == 8
  assert len(random_string(12)) == 12
  assert len(random_string(4)) == 4
output: import random
  import string
  
  def random_string(length):
      characters = string.ascii_letters + string.digits
      return ''.join(random.choice(characters) for _ in range(length))