input: Write a function to generate a random string of the specified length containing alphanumeric characters. If the length is not provided, the function should return an empty string.
  def generate_random_string(length=8):
   chars = string.ascii_letters + string.digits
   return ''.join(random.choice(chars) for _ in range(length)) if length > 0 else ''
  
  assert generate_random_string()=='a1B2c3D4'
  assert generate_random_string(3)=='0A7'
  assert generate_random_string(0)==''
  assert generate_random_string(5)=='zYxWv'
output: def generate_random_string(length=8):
   chars = string.ascii_letters + string.digits
   return ''.join(random.choice(chars) for _ in range(length)) if length > 0 else ''