Color theme
0 day streak0 XPP1
PythonLearn mode
MISSION 1 OF 1

Read the tail of a log

0 XP earned
Python track: BeginnerMission: BeginnerList slicingNegative indexesString joining
Before you start this beginner track

Variables, strings, and basic lists. Build up to dictionary counting.

Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.

x
0 / 2 challenges
LEARN THE CONCEPT

Understand it, then try it.

A list preserves the order of its entries. Negative indexes count from the end, so -2 identifies the second-to-last item. A slice beginning there and ending at the list’s end keeps the latest two events. join displays those events as a readable sequence without changing the original list.

mission.py
events = ["boot", "scan", "sync", "sleep"]recent = events[-2:]summary = " -> ".join(recent)print(summary)

Run each standalone script with Python 3.8+. File names and log entries are in-memory sample text; no files, packages, or input are required.

Track the values line by line. Predict the result before running this example in your own editor.