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} }
Implement a function fib(n)
that returns a list with the first n
numbers of Fibonacci. If n == 0
, the function must return the list [1]
, if n == 1
, the function must return the list [1,1]
. When n < 1
, then start with the list [1,1]
and add the next Fibonacci number by adding the previous numbers in the list.
For example by typing:
>>> print(fib(0))
[1]
>>> print(fib(1))
[1, 1]
>>> print(fib(2))
[1, 1, 2]
>>> print(fib(12))
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233]
Don’t forget your pytests to automate the tests!