input: Write a function to generate random passwords that consist of 8 characters using letters and digits from the `string` module. If the function is properly implemented, it should return a string with 8 characters that are either letters or digits.
  
  def generate_password():
      chars = string.ascii_letters + string.digits
      return ''.join(random.choice(chars) for _ in range(8))
  
  assert len(generate_password()) == 8
  assert any(c.isdigit() for c in generate_password())
  assert any(c.isalpha() for c in generate_password())
output: def generate_password():
      import string
      import random
      chars = string.ascii_letters + string.digits
      return ''.join(random.choice(chars) for _ in range(8))