Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.
Join our LinkedIN Community.
Use the following BibTeX entry to cite this work:
@INPROCEEDINGS{DVMB2023, author={Doorn, Niels and Vos, Tanja and Marín, Beatriz and Barendsen, Erik}, booktitle={2023 IEEE Conference on Software Testing, Verification and Validation (ICST)}, title={Set the right example when teaching programming: Test Informed Learning with Examples (TILE)}, year={2023}, volume={}, number={}, pages={269-280}, doi={10.1109/ICST57152.2023.00033} }
Write a function (dniLetter
) that, given a DNI number, returns the letter that corresponds to it. The algorithm to calculate the control letter of a DNI is the following:
Find the remainder by dividing the number by 23
The letter is obtained using the remainder as index of the following table:
REMAINDER | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
LETTER | T | R | W | A | G | M | Y | F | P | D | X | B |
REMAINDER | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
---|---|---|---|---|---|---|---|---|---|---|---|
LETTER | N | J | Z | S | Q | V | H | L | C | K | E |
Complete the table with the number of rows you consider necessary to design your test set and run the automatic tests with pytest.\
test case number | input | expected output |
---|---|---|
1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 |