Adjust lines of Python codes