Help me please! SyntaxError: invalid syntax


#1

import random

tablero = []

for x in range(0,5):
tablero.append(["O"] * 5)

def print_tablero(tablero):
for fila in tablero:
print " ".join(fila)

print "Juguemos as la batalla naval!"
print_tablero(tablero)

def fila_aleatoria(tablero):
return random.randint(0,len(tablero)-1)

def columna_aleatoria(tablero):
return random.randint(0,len(tablero[0])-1)

barco_fila = fila_aleatoria(tablero)
barco_columna = columna_aleatoria(tablero)
print barco_fila
print barco_columna

for turno in range(4):
adivina_fila = input("Adivina fila: ")
adivina_columna = input("Adivina columna: ")

if adivina_fila == barco_fila and adivina_columna == barco_columna: #Correcto
	print "Felicitaciones! Hundiste mi barco!"
else: #Incorrect
	if (adivina_fila < 0 or adivina_fila > 4) or (adivina_columna < 0 or adivina_columna > 4):
		print "Huy, eso ni siquiera esta en el oceano."
    elif (tablero[adivina_fila][adivina_columna] == "X"):
        print "Ya dijiste esa."
    else:
	    print "No tocaste mi barco!"
	    tablero[adivina_fila][adivina_columna] = "X"

# ¡Mostrá (turno + 1) acá!
print "Turno", turno + 1
if turno == 3: #fin juego
print "Fin del juego."

print_tablero(tablero)

Error:

File "python", line 37
elif (tablero[adivina_fila][adivina_columna] == "X"):
^
SyntaxError: invalid syntax


#2

In the code you pasted if is not on the same indent as elif and else. This is the first thing that I would check.