Stack Python Code Using Functions To Model