solution for edX course - MITx: 6.00.1x Introduction to Computer Science and Programming