We finally have a winner, check the results!
We finally have a winner, check the results!
Subject of the contest is to code the shortest possible python module that converts decimal numbers to the seven-segment display format. To support leading zeroes the decimal number is given as a string.
A string containing "23" will result in:
_ _ _| _| |_ _|
Or more precisely in the string:
" _ _ \n _| _|\n|_ _|\n"
The module has to be named seven_seg and has to define the function seven_seg. The function seven_seg takes a string as parameter and returns a string.
We provide a test suite that you can use to verify your results. We use a very similar test suite to either accept or reject pending submissions.
Get your test suite here (zip)
The test suite contains the following files:
seven_seg.py | a skeleton for your module |
test_vectors.py | a dictionary of test vectors |
test.py | the test case, it imports seven_seg and verifies it with the help of the test vectors |
Any question? Check the FAQ!