sys.exit

This command is useful to exit a program before it reaches the bottom of the script
import sys
if hitpoints <= 0:
    print("Your hero is dead")
    sys.exit(0)

#Import sys at the top of your program
#If hitpoints are equal or less than 0
#Final message before you end the program
#Command that exits the program


Comments