File system · 6 / 15 Exercise Easy

List a folder

Objective

The program runs inside a folder that already contains the files of the test case. With Path.iterdir() you walk through the content of a folder, and with is_dir() or is_file() you tell files from folders.

Instructions

  • Show, sorted by name and one per line, the content of the current folder (Path(".")).
  • Folders are shown with a / at the end.
  • The content of subfolders does not need to be shown.

Example. With the files b.txt, a.py and docs/leeme.md it shows a.py, b.txt and docs/.

Output
a.py
b.txt
docs/

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise