Python in game engine

i am trying to make it so the player has a value (health) say 10 and when an enemies weapon collides with the players body it subtracts 2 from the initaial value of ten and when the value is zero it deletes th object.

heres how i think it would go but i know it needs to be a little more techinical.ANy help would be appreciated , also if someone could point me toward a website so that after is write this script i can learn how to make my scripts readeable by the commputer with actual commands and correct format. i have seen scripts for the blender game engin isn’t there something that also goes at the top?

Obj player = value
value = 10
if Obj player collides with obj (enemysword) - 2 from value
if value = 0
end obj (player)