input: Write a function to generate a random string of length 8 composed of letters and digits.
  assert len(generate_string()) == 8
  assert isinstance(generate_string(), str)
  assert all(c.isalnum() for c in generate_string())
output: import random
  import string
  
  def generate_string():
      characters = string.ascii_letters + string.digits
      return ''.join(random.choice(characters) for _ in range(8))