import easygui, random yhp = 1000 ehp = 1000 easygui.msgbox("Welcome to the battle field!\nGet ready!!") while True: if yhp <= 0: easygui.msgbox("You lost the battle!!") break weapon = easygui.buttonbox("Your turn to attack, please choose your weapon", choices = ['gun', 'missile']) if weapon == 'gun': damage = random.randint(1, 100) easygui.msgbox("You chose " + weapon + ", deal " + str(damage) + " damage", image = 'gun.gif') ehp -= damage elif weapon == 'missile': # homework pass if ehp <= 0: easygui.msgbox("You Won the battle!!") break damage = random.randint(20, 150) easygui.msgbox("Enemy's turn to attack, you got " + str(damage) + " damage and have " + str(yhp) + " HP left")