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

single

bookChallenge: Find Lines with Keyword

Swipe to show menu

Task

Swipe to start coding

Write a function that prints all lines from a list that contain a specific keyword.

  • Iterate through each string in the lines list.
  • For each string, check if the keyword is present.
  • Print every string that contains the keyword.

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 16
single

single

Ask AI

expand

Ask AI

ChatGPT

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

some-alt