THINK FIRST·CODE LATER

← All labs

Does the validation match the level?

Problem

Check a project's evaluation plan against the nested model. Each input line is claim: LEVEL | method: METHOD. Known methods and the level they validate: interview, observation (1, immediate); adoption rate (1, downstream); field study, case study with target users (2, downstream); perceptual justification (3, immediate); lab study, controlled experiment, image quality measurement (3, downstream); complexity analysis (4, immediate); benchmark (4, downstream). Level names: 1 domain situation, 2 data/task abstraction, 3 encoding/interaction idiom, 4 algorithm.

Print OK level 1 (domain situation) <- interview [immediate] (OK followed by 7 spaces), MISMATCH level 3 claimed, but 'benchmark' validates level 4 (algorithm) or ? level 2, 'survey': unknown method; then levels validated: 1, 3, 4 (levels of known methods, sorted, or none) and not validated: 2 (data/task abstraction) (or none).

Data for this lab

Your program reads its data from standard input. Download the file, then give it to your program as shown below. Start with data set 1: its expected output is given.

v3-3-data-1.txt

claim: 3 | method: benchmark
claim: 1 | method: interview
claim: 3 | method: controlled experiment
claim: 2 | method: lab study
What your program must print for v3-3-data-1.txt
MISMATCH level 3 claimed, but 'benchmark' validates level 4 (algorithm)
OK       level 1 (domain situation) <- interview [immediate]
OK       level 3 (encoding/interaction idiom) <- controlled experiment [downstream]
MISMATCH level 2 claimed, but 'lab study' validates level 3 (encoding/interaction idiom)
levels validated: 1, 3, 4
not validated: 2 (data/task abstraction)

Run your program first, then open this and compare line by line: your output must contain these lines exactly.

How to give the file to my program

Terminal (macOS, Linux, or Windows Command Prompt), in the folder that holds both files:

python my_lab.py < v3-3-data-1.txt

Windows PowerShell (the default terminal of VS Code on Windows) does not understand <:

Get-Content v3-3-data-1.txt | python my_lab.py

PyCharm: Run → Edit Configurations → tick Redirect input from and choose the file.

Jupyter: put this at the top of the cell that holds your program:

import sys
sys.stdin = open("v3-3-data-1.txt", encoding="utf-8")

Write it here, in Jupyter or in your IDE, then paste it. Run it on the sample input yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.