A Algorithm Example Code Python