#8 Add two new variables to the loop: `right_values`

and `right_max`

.

Use the same logic as before, but for values at indices **greater than** the current index.

I’m assuming this is what it is asking?

```
right_values = histogram[i:]
right_max = max(right_values)
```

```
from time import time
#We’ll start with an input where we can easily determine the answer. Add the following variable to script.py:
small = [1, 0, 1]
#Now let’s use a more complicated input:
medium = [4, 2, 1, 3, 0, 1, 2]
#This input will collect no water, but it’s good to test these cases where something unusual might happen.
edge_case = [0, 2, 0]
edge_case1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
#Define the rain_water() function, which has one parameter: histogram, a Python list of positive integers.
#Let’s start by finding the maximum value at a lesser index for each value in the list.
#Iterate from index 1 to the second to last index of histogram.
#Within the loop, declare left_values and set it to every value up to but not including the current index.
#Below left_values, declare another variable: left_max. This should be the maximum value within left_values.
#Add print() statements to check out the variables.
#Add two new variables to the loop: right_values and right_max.
#Use the same logic as before, but for values at indices greater than the current index.
def rain_water(histogram):
for i in range(1, len(histogram) - 1):
left_values = histogram[:i]
left_max = max(left_values)
right_values = histogram[i:]
right_max = max(right_values)
print(right_values)
####### TEST INPUTS HERE
####### NAIVE SOLUTION HERE
####### OPTIMIZED SOLUTION HERE
####### BENCHMARKING HERE
rain_water(edge_case1)
```

[1, 2, 3, 4, 5, 6, 7, 8, 9]

[2, 3, 4, 5, 6, 7, 8, 9]

[3, 4, 5, 6, 7, 8, 9]

[4, 5, 6, 7, 8, 9]

[5, 6, 7, 8, 9]

[6, 7, 8, 9]

[7, 8, 9]

[8, 9]