
ALT A Python script using Qiskit. It creates QuantumCircuit(1, 1), with one qubit and one classical bit, applies a Hadamard gate with qc.h(0), measures qubit 0 into bit 0 with qc.measure(0, 0), and prints the circuit. The printed text diagram shows the qubit line q passing through an H box and then an M box, with a double line down to classical bit 0.

ALT Python script. A fake model prints each tool's name and description as Pydantic AI registers them. Two tools are registered with @agent.tool_plain: find_breed_info, with the docstring "Find information about a cat breed.", and find_vet, with no docstring. The output is find_breed_info: 'Find information about a cat breed.' and find_vet: None.

ALT Python REPL. A Pydantic model CityInfo has name as str and population as int. A JSON reply with population set to the string "about 14 million" is validated with CityInfo.model_validate_json, and the ValidationError message printed is: Input should be a valid integer, unable to parse string as an integer.

ALT Python REPL. The same bytes, b"d\xe9j\xe0 vu", decoded three ways. errors="ignore" returns dj vu, with two letters gone. errors="replace" returns d, a replacement character, j, another replacement character, then vu. errors="backslashreplace" returns the text with backslash x e 9 and backslash x e 0 written out where the bad bytes were.

ALT A pytest test, test_feed_caps_at_max, parametrized with (1, 1), (10, 10) and (15, 10). It creates an AlienPet, calls feed() the given number of times and asserts fed_level equals the expected value. Running pytest -q shows the 15-feedings case failing with assert 11 == 10, and the other two passing: 1 failed, 2 passed.

![A Python REPL session. The list comprehension [pow(7, k, 15) for k in range(1, 9)] computes 7 to the power k, modulo 15, for k from 1 to 8. It prints [7, 4, 13, 1, 7, 4, 13, 1]: the same four values repeating.](https://pbs.twimg.com/media/HXbEnOhW4AA_DVU.jpg?name=small&format=webp)



