Range And Exit Function In Python