Please help, new to programming. Error: Recursive trouble handling with operator '>'

I'm trying to solve an error my code keeps generating, with the question "House Robber". How do i go about solving this. I know there are solution available, but I'm not sure what the error in the code is. Any help available will be super super helpful.

Here's the code:

class Solution:
def rob(self, nums: List[int]) -> int:

    num = [0] + nums
    
    if len(num) < 3:
        return num
    if len(num) == 3:
        return max(num)
    
    while len(num) >= 4:
        result = num[-1] + max(Solution.rob(self, nums[:len(num) - 3]),Solution.rob(self, nums[:len(num) - 2]))

        return result
                          

Here's the error:

TypeError: '>' not supported between instances of 'int' and 'list'
result = num[-1] + max(Solution.rob(self, nums[:len(num) - 3]),Solution.rob(self, nums[:len(num) - 2]))
Line 13 in rob (Solution.py)
result = num[-1] + max(Solution.rob(self, nums[:len(num) - 3]),Solution.rob(self, nums[:len(num) - 2]))
Line 13 in rob (Solution.py)
ret = Solution().rob(param_1)
Line 36 in _driver (Solution.py)
_driver()
Line 47 in (Solution.py)

Comments (1)