input: Write a function to generate a random string of specified length. The function should take an integer as input and return a string consisting of lowercase letters. If the input length is invalid (e.g., non-positive), the function should return an empty string.
  import random
  import string
  def random_string(length):
      if length <= 0:
          return ""
      letters = string.ascii_lowercase
      return ''.join(random.choice(letters) for i in range(length))
  assert random_string(6)!=""
  assert len(random_string(6))==6
  assert random_string(-1)==""
  assert random_string(0)==""
output: import random
  import string
  def random_string(length):
      if length <= 0:
          return ""
      letters = string.ascii_lowercase
      return ''.join(random.choice(letters) for i in range(length))