Python Program With Algorithm