Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: List Files with Extension | Automating Tasks with Python
Automating System Tasks with Python: A Beginner's Guide
Section 1. Chapter 18
single

single

bookChallenge: List Files with Extension

Swipe to show menu

Task

Swipe to start coding

Write a function that filters and prints filenames ending with ".txt" from a given list.

  • Loop through each element in the filenames list.
  • Check if the current filename ends with ".txt".
  • If it does, print the filename.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 18
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt