Skip to main content
πŸ”’ Preview mode. The first 15 Foundations lessons are free; this one is Pro. Start a 7-day trial to unlock the editor, AI hints and the rest of the curriculum. Card required, cancel any time in Dashboard.Start 7-day trial β†’
⚑
← Coursesβ€ΊPython FoundationsModule 8 Β· Modern Python and capstoneβ€Ίpathlib β€” modern path handlingpredict163 / 174
+100 XP
Task
πŸ“ **Question:** Predict the two lines printed. \`.name\` returns the final segment ("today.log"); \`.suffix\` returns the extension with the dot. πŸ“‹ Pick the right answer. πŸ’‘ **Hint:** Re-read the theory above if unsure.
Predict the output

Read the code carefully

from pathlib import Path

p = Path("data") / "logs" / "today.log"
print(p.name)
print(p.suffix)

What will the program print? Write here: