Syntax error WHYYYY!


#1

I’m looking at the vanilla code for this exercise. I’m questioning why on line 21 , I cant recycle range(0, len(board[0]) - 1) from line 18. when I try this I get a syntax error. Why?
Adding this code to line 21 should future proof my code.
if guess_row not in range(5) or
guess_col not in range(5):


#2

please include both exercise url and both the faulty code (which uses range(0, len(board[0] - 1) where you can’t use it)


#3

#4

I asked for the exercise url, what so difficult about that? Now i have to guess which exercise you are at.

well, look:

print range(0, len(board[0]) - 1) 
print range(5)

they produce different lists.

range() does not include the stop value (4) where randint does.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.