Sink my battleship


#1

the range for user and computer to guess is from 0 to 4
isn't it better if the range could be from 1 to 5?
'cause i won't guess at point 0


#2

@joanzi

It is a simple case to adjust the user input accordingly.

Python Code:

>>> num = 5
>>> num -= 1
>>> print(num)
4

Doing this will allow you to write simple code and just adjust the user input to your system.


#3

If I get you correctly, the reason your range starts at 0 and ends at 4 rather than that is, range works like this: range(start, stop, step) and so, 0 is merely a position in that list.

And of course if the user won't guess at point zero and the answer lies there, it's a loss. However, if the user tries to guess 5, out of range will be given. It's a game really and you could determine which way it goes. :slight_smile:


#4

i don't have problem with this range, but i got stuck with the following steps
the you win, the bad aim
i wrote the code as the instruction, but it just didn't show right:sweat:


#5

thanks, i'm still working on this battle :smile: