12. Bad Aim


My code works fine but when i give a no outside the range it shows " Traceback (most recent call last):
File "python", line 33, in
IndexError: list index out of range "

Shouldn't it print "Oops, that's not even in the ocean." So what is the flaw in the code ???


line 33, you try to access indexes of the list, which will give an error. Your error checking should be earlier (not in range(5))

I will have a more detailed look at the instructions later.


I got the desired answer once i removed that line but now when i input no's inside the range it doesn't show You missed my Battleship .


i suggested you moved your error checking (if not in range 5) to before line 33 which causes an error


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