input: Write a function to generate a random string of length 8 made of uppercase letters and numbers. If the input is empty, return an empty string.
  assert random_string("") == ""
  assert len(random_string()) == 8
  assert random_string().isalnum() == True
  assert random_string().isupper() == True
output: import random
  import string
  
  def random_string(length=8):
      if length == 0:
          return ""
      return ''.join(random.choices(string.ascii_uppercase + string.digits, k=length))