In your example that uses directory() for the output, you demonstrate that you need to manually run mkdir. I think it's important to tell the learners that manually running mkdir isn't needed for a standard rule. My old Snakefiles used to be cluttered with mkdir and os.mkdir(), but this is unnecessary because Snakemake automatically creates the subdirectories for you. Below is an example to demonstrate this behavior:
From @jdblischak
In your example that uses directory() for the output, you demonstrate that you need to manually run mkdir. I think it's important to tell the learners that manually running mkdir isn't needed for a standard rule. My old Snakefiles used to be cluttered with mkdir and os.mkdir(), but this is unnecessary because Snakemake automatically creates the subdirectories for you. Below is an example to demonstrate this behavior: