Ascending Order Function In Python