input: Write a function to generate a random string of a specified length using the characters from the set of lowercase and uppercase letters and digits. If the specified length is 10, the function should return a random string of 10 characters.
  assert generate_string(10) in [c for c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'] * 10
  assert len(generate_string(10)) == 10
  assert generate_string(5) in [c for c in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'] * 5
  assert len(generate_string(5)) == 5
  assert generate_string(0) == ''
  assert len(generate_string(0)) == 0
output: import random
  import string
  
  def generate_string(length):
      return ''.join(random.choices(string.ascii_letters + string.digits, k=length))