CODING
ADVENTURE
0 / 12 completed

CASE 10 / CHAPTER 11

Repair the Genesis copy

Integrity checks and completeness

IN THE STORY

The team has a trusted manifest of the correct pieces of a file. One received piece has been damaged. No actual network is involved.

The idea

A dictionary associates a key with a value. Here the key is a piece number and the value is its expected fingerprint. items lets the loop visit both. We keep a separate received dictionary and compare each piece with the trusted manifest. Counting matches prevents a program from claiming success after checking only one piece.

Your mission

Complete the final comparison. Release the copy only when the count of verified pieces equals the count of expected pieces.

Replace ____ with the missing expression, then choose Run code. Match the expected output before trying your own changes.

Before you run it

Why is it wrong to print “Complete” after any one piece passes?

A little help?

Hint 1: a nudge

len returns the number of entries in the manifest.

Hint 2: a closer look

Compare verified == len(expected).

How the answer works

The damaged middle piece fails. Change it to IS and all three pass. This is verification against a trusted baseline, not virus removal or proof of identity.

This replaces the code in the editor. Save your version first if you want to keep it.

Make it yours

In Build Game Two, run genesis_recovery.py. Retry the damaged copy, then release the verified copy. Test a missing piece too.

verify_upload.pyPYTHON 3

Four spaces indent a block. Ctrl / ⌘ + Enter runs your code. Tab moves to the next control.

OUTPUTPython loads when you run
Your program's output will appear here.

Take a guess. Try a line. See what happens.

Expected output

Retry damaged or missing pieces

Code runs on your device. The first run downloads the Python engine (about 10 MB); later runs use the browser cache. Stop ends a run without losing your code.