Some Python code written for programming assignment