How To Write Algorithm For Python