HW0 code in Python