Python program to solve the "rod-cutting problem"
First of all, it's really a bad idea to change the value of the input parameter when this change has an outer effect in some other place in your code.

Also, You can get rid of recursive function calls, that makes your code so much faster.
So let's start from cut_rod_helper function:

def cut_rod_helper(p, n, r, s):
    q = 0
    for i in range(1, n + 1):
        temp = p[i] + r[n - i]
        if q &lt; temp:
            q = temp
            s[n] = i
    return q


I removed comments for more clear view here. But it's good to have them in your code.

What I did here is removing recursion. I removed first if statement from your code because we don't do recursive call and don't need end of recursion statement. As you can see at the middle of the function, we get r value from that list directly.

Second change here is I removed second if statement in your code because we don't need this (At least when we only have prices more than zero). Fewer conditions mean better code. Because with fewer if and else, the code is more straightforward and less error-prone. Also in many cases, the if-less code is faster. So always try to minimize the number of if conditions in your code.

We can simply set q value to zero initially. If n be 0, range of for loop will be (1,1), when start and stop values of a for loop are same, that for will not execute. So you don't need to consider a different condition for that.

And the biggest trick is in the third line of the function. We really don't need recursive call. If we start calling helper function from 0 to n index of r, we always have previous values in the r and we can access them directly.

Now let's go to the primary function:

def cut_rod(p, n):
    r = [-1]*(n + 1)
    s = [-1]*(n + 1)
    r[0] = 0
    for i in range(1, n + 1):
        r[i] = cut_rod_hezerolper(p, i, r, s)
    return r, s


We have only two changes here. First, I have been set index 0 of r to zero. It's our initial state and is clear from problem description. length = 0 so price = 0!

Then, for avoiding the change of input parameters, We are looping through the r and set value of each index of it. Because for calculating ith value of r, we only need access to i - 1 values of it, and we have been set initial value r[0] and start our loop from i = 1, now our code works without any problem.

I did not a full performance test, but with few tries, the second version is about 3 times faster than the first version of your code.

In the end, I did not change variable names, because I think that may distract you. But I think you should change your variable names. s, r, q and ... are meaningless. If a variable is a list contains prices, you should name it something like prices_list. If you do that, you don't need many lines of those comments and everyone can find out what you did in your code at first glance. Spending some seconds on naming things in programming, saving minutes and hours later.

I hope this helps you.