Rolling Function In Python Programming