Write Python. Understand every error.

Starting Python in your browser…

Project

Word statistics

Analyse a sentence: count words, find the longest word and the most common word.

  1. Read one line of text and print Words: followed by the number of words in it.
  2. Add a line Longest: followed by the longest word. If several words have the same length, use the first one.
  3. Count how often each word appears using a dictionary, and add a line Most common: followed by the most frequent word (the first one to reach the highest count if there is a tie). Treat words in lowercase.

Ctrl + Enter to run
Line 1, column 1Tab indents 4 spaces. Press Esc then Tab to leave the editor.