input: Write a function to generate a random password of 8 characters consisting of letters and digits. Return the generated password as a string. If no input is provided, the program should automatically generate the password.
  assert generate_password().isalnum()==True
  assert len(generate_password())==8
  generated_password = generate_password()
  assert isinstance(generated_password, str)
  assert any(c.isdigit() for c in generated_password)
  assert any(c.isalpha() for c in generated_password)
output: import random
  import string
  
  def generate_password():
      return ''.join(random.choices(string.ascii_letters + string.digits, k=8))