detailed comments for problem2.py