Error in create_train_test_dirs() even after getting expected output in colab

Getting error tried so many times my code gives expected results but still fails when submitting:

Failed test case: testing/cats subdirectory was not found. And also fails other directory test here is my code:

def create_train_test_dirs(root_path):
  """
  Creates directories for the train and test sets
  
  Args:
    root_path (string) - the base directory path to create subdirectories from
  
  Returns:
    None
  """  
  ### START CODE HERE

  # HINT:
  # Use os.makedirs to create your directories with intermediate subdirectories
  # Don't hardcode the paths. Use os.path.join to append the new directories to the root_path parameter

  try:
    os.mkdir(root_path)
    os.mkdir(root_path + '/training')
    os.mkdir(root_path + '/testing')
    os.mkdir(root_path + '/training/cats')
    os.mkdir(root_path + '/training/dogs')
    os.mkdir(root_path + '/testing/cats')
    os.mkdir(root_path + '/testing/dogs')
  except OSError:
       pass

  

Hi @Aryan_Chaurasia,

Thank you for joining the community. The second hint suggests using os.path.join, maybe the error might be caused by that.

Good luck,
Davide