You just need to fix the indentation
r = 0
while r<15:
hit = str(input("""A1 A2 A3 A4 A5\n\nB1 B2 B3 B4 B5\n\nC1 C2 C3 C4
C5\n\nD1 D2 D3 D4 D5\n\nE1 E2 E3 E4 E5\nThis is the board. Pick any co-
ordinate you want to fire on: """))
if hit in ("A2", "a2"):
print("You hit on target A2!")
elif hit in ("B2", "b2"):
print("You hit on target B3!")
elif hit in ("C1", "c1"):
print("You hit on target C1!")
elif hit in ("C2", "c2"):
print("You hit on target C2!")
elif hit in ("D5","d5"):
print("You hit on target D5!")
elif hit in ("E1", "e1"):
print("You hit on target E1!")
elif hit in ("E3", "e3"):
print("You hit on target E3!")
else:
print("You missed!")
r+=1
The code that will run inside the loop is executed by the indentation so if your first line inside the loop is not indebted then the following code will not execute as part of the loop.
And to check the hit
value is equal to one of two options it will be better in
0
solved How to call an if statement during a while loop in python [closed]