ASC#6: Python solution to A