def count_min_cost(n, price: list): c = [float("-inf"), price[1], price[1] + price[2] + [0] * (n-2)] for i in range(3, n+1): c[i] = price[i] + min(c[i-1], c[i-2]) return c[n] code example
Example: float inf in python
float('inf')
float('-inf')
float('inf')
float('-inf')