Learn
You can successfully make one guess in Battleship! But we’d like our game to allow the player to make up to 4 guesses before they lose.
for turn in range(4): # Make a guess # Test that guess
We can use a for
loop to iterate through a range. Each iteration will be a turn.
Instructions
1.
Add a for
loop that repeats the guessing and checking part of your game for 4 turns, like the example above.
At the beginning of each iteration, print "Turn", turn + 1
to let the player know what turn
they are on.
Indent everything that should be repeated.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.