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

single

bookChallenge: Word Counter

Swipe to show menu

Task

Swipe to start coding

Write a function that counts how many times a specific word appears in a sentence.

  • Receive a sentence and a word as arguments.
  • Count the number of times word appears in sentence when splitting the sentence into words by whitespace.
  • Return the count as an integer.

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

single

Ask AI

expand

Ask AI

ChatGPT

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

some-alt