Conditional Statements Practice Problems 12/22

Screen Link:
Conditional Statements Practice Problems | Dataquest

My Code:

for e in range(len(values1)):
    if values1[e] == values2[-e-1]:
        is_reversed = True
        

What I expected to happen:

It would come out false since values1[10] != values2[-11]

What actually happened:

True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True
True

Oddly enough if I also write:

if values1[10] == values2[-11]:
   print(True)       

I will still get true even though values1[10] = 101 and values2[-11] = 110. I know I am once again missing something simple here but can’t seem to figure it out. Any help would be appreciated.

Your code doesn’t have any way of displaying a False right now. It will only display True when the condition is met. Otherwise, it does nothing.

len(values1) is 21. You have 20 total Trues. Your code is working as expected. You need to add code to display a False when the condition isn’t met.

Ah I see, thank you so much!