Ask coding questions
So this code wont work
guess_row = input("Guess Row: ")
guess_col = input("Guess Col: ")
if guess_col == ship_col:
if guess_row == ship_row: #if the user input is correct then it will display "HIT"
elif guess_col != ship_col or guess_row != ship_row: #if it is incorrect it will display "miss"
I'm confused as to what i did wrong
it will be false because you are using the or statementso that meansthe x value and the y value must not be the same, not or.
here is a more efficient code:
if guess_col == ship_col and guess_row == ship_row: