If you read the error message, you'd see immediately what the problem is:
File "main.py", line 43
attackpower=2
^
TabError: inconsistent use of tabs and spaces in indentation
You're only allowed to use either spaces or tabs for indentation. And that's an exclusive or. If you use tabs, you cannot use spaces. Stick with one, do not switch around.
Starting from line 20 you've got mixed tabs and spaces indentation. I suggest copying all your code into a text editor where you can display white space characters and make sure you use all tabs or all spaces, not mixed up.
Also, you should call your battlecode_() function to make anything happen. E.g. do it at the last line (without any indentation)
Your while loop seems to have the wrong logic too. I think this would be the right logic:
while mercy == 0 and hp > 0 and crabhp > 0:
I see your code is ufinished. Keep working, reading the error messages and fixing things accordingly.