Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1for shift in range(1, 26): | Afor shift in range(1, 26): print(shift, decrypt(secret, shift)) | |
| 2print(shift, decrypt(secret, shift)) | Brange(1, 25) stops at 24, so shift 25 is never tried and the correct answer could be missed. It should be range(1, 26). | |
| 3To brute-force a Caesar cipher, try every shift from 1 to 25 and decrypt the message each time | Cif "hello" in text: break | |
| 4The brute-force loop can stop as soon as a known word appears in the decrypted text | DLoop that tries every possible Caesar shift from 1 to 25 in turn | |
| 5for shift in range(1, 25): | EThe shift is not printed beside each result, so you cannot tell which shift produced the readable message. It should print shift as well. | |
| 6for shift in range(1, 26): print(decrypt(secret, shift)) | FShows each shift number beside the message it produces, so you can spot the readable one |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
for shift in range(1, 26): — A loop that tries every Caesar shift from 1 to 25. Each pass decrypts the message and prints the shift beside the result, so you can spot the readable one.for shift in range(1, 26):
result = decrypt(message, shift)
print(shift, result)for shift in range(1, 26):
result = decrypt(message, shift)
print(shift, result)for shift in range(1, 26):
result = decrypt(message, shift)
print(shift, result) result = decrypt(message, shift)
if "the" in result:
breakfor shift in range(1, 26):
result = decrypt(message, shift)
print(shift, result)