Mal visé! Doesn't work why?

#1

Hello,
I don't understand my mistake.

My code show the right answer if I execute it but codecademy is not happy and say that it's not the case...
Error from codecademy: "Oups merci de reesayer votre code n'affiche pas "Oups! Vous devez viser l'ocean.""
I don't get it...

Please help me as I can't go to the next exercise it's verry frustrating (the part of my code that has the problem is in Bold at the end).

Here is my code:

from random import randint

plateau = []

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

def afficher_plateau(plateau):
for ligne in plateau:
print " ".join(ligne)

afficher_plateau(plateau)

def alea_ligne(plateau):
return randint(0, len(plateau) - 1)

def alea_col(plateau):
return randint(0, len(plateau[0]) - 1)

bateau_x = alea_ligne(plateau)
bateau_y = alea_col(plateau)

tir_x = int(raw_input("Quelle ligne ?"))
tir_y = int(raw_input("Quelle colonne ?"))
print bateau_x
print bateau_y

if tir_x==bateau_x and tir_y==bateau_y:
print "Bravo ! Vous avez eu mon bateau !"
else:
if tir_x<0 or tir_x>(len(plateau)-1) or tir_y<0 or tir_y>(len(plateau[0])-1):
print"Oups! Vous devez viser l'ocean."

#2

The reason why ur code isn't working is that u write "Oups! Vous devez viser l'ocean."
u should write "Oups ! Vous devez viser l'ocean"

#3

hey, mine looks correct but same error help please !
else:
if tir_x<0 or tir_x>(len(plateau)-1) or tir_y<0 or tir_y>(len(plateau[0])-1):
print "Oups ! Vous devez viser l\'ocean"

ps: I tried with and without "." a the end !

#4

my code working well

from random import randint

plateau = []

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

def afficher_plateau(plateau):
for ligne in plateau:
print " ".join(ligne)

afficher_plateau(plateau)

def alea_ligne(plateau):
return randint(0, len(plateau) - 1)

def alea_col(plateau):
return randint(0, len(plateau[0]) - 1)

bateau_x = alea_ligne(plateau)
bateau_y = alea_col(plateau)
tir_x = int(raw_input("Quelle ligne ?"))
tir_y = int(raw_input("Quelle colonne ?"))

Ajoutez votre code ci-dessous :

if tir_x == bateau_x:
print "Bravo ! Vous avez eu mon bateau !"
else:
print "Dommage !"
if tir_x == 0 and tir_y == 0:
print "Oups ! Vous devez viser l'ocean."
if tir_x > 5 and tir_y > 5:
print "Oups ! Vous devez viser l'ocean."

#5

you can use or instead of many if