Problems 1-5 in Python