I was wondering how can I change sys.exit so if you use command line to run the program. it prompts a message asking if the user wants to exit instead of automatically just exiting?<div><br></div><div>import random</div><div>
import sys</div><div><div>my_hp = 50</div><div>    mo_hp = 50</div><div>    menu1 = &quot;&quot;&quot;</div><div>        Menu Selections: </div><div>        1 - Attack</div><div>        2 - Defend</div><div>        3 - Help</div>
<div>        4 - Exit</div><div>        &quot;&quot;&quot;</div><div>    print menu1</div><div>    while True:</div><div>        my_dmg = random.randrange(1, 20)</div><div>        mo_dmg = random.randrange(1, 20)</div><div>
<br></div><div>        choice = input (&quot;\nEnter your selection. &quot;)</div><div>        choice = float(choice)</div><div>        print</div><div>        if choice == 1:</div><div>            mo_hp = mo_hp - my_dmg</div>
<div>            if mo_hp &lt;= 0:</div><div>                print &quot;Iris is at 0 Hit Points!\nYOU HAVE SLAIN IRIS!&quot;</div><div>                sys.exit(0)</div><div>            elif mo_hp &gt; 0:</div><div>                print &quot;-----------------------------------------------------------------&quot;</div>
<div>                print &quot;Iris is at %s Hit Points\nYou did %s damage\n&quot; % (mo_hp, my_dmg)</div><div>            my_hp = my_hp - mo_dmg</div><div>            if my_hp &lt;= 0:</div><div>                print &quot;Your Hit Points are 0!\nYOU HAVE BEEN SLAIN BY Iris!&quot;</div>
<div>                sys.exit(0)</div><div>            elif my_hp &gt; 0:</div><div>                print name,&quot;was attacked by Iris for %s damage!\nMy Hit Points are %s&quot; % (mo_dmg, my_hp)</div><div>                print &quot;-----------------------------------------------------------------&quot;</div>
<div>            else:</div><div>                print menu1</div><div>                </div><div>                </div><div>        elif choice == 2:</div><div>            mo_hp = mo_hp - my_dmg / 2</div><div>            if mo_hp &lt;= 0:</div>
<div>                print &quot;The Lich King is at 0 Hit Points!\nYOU HAVE SLAIN IRIS!&quot;</div><div>                sys.exit(0)</div><div>            elif mo_hp &gt; 0:</div><div>                print &quot;-----------------------------------------------------------------&quot;</div>
<div>                print &quot;The Lich King is at %s Hit Points\nYou did %s damage\n&quot; % (mo_hp, my_dmg)</div><div>            my_hp = my_hp - mo_dmg / 2</div><div>            if my_hp &lt;= 0:</div><div>                print &quot;Your Hit Points are 0!\nYOU HAVE BEEN SLAIN BY IRIS!&quot;</div>
<div>                sys.exit(0)</div><div>            elif my_hp &gt; 0:</div><div>                print name,&quot;was attacked by the Iris for %s damage!\nMy Hit Points are %s&quot; % (mo_dmg, my_hp)</div><div>                print &quot;-----------------------------------------------------------------&quot;</div>
<div>            else:</div><div>                print menu1</div><div>                </div><div>        elif choice == 3:</div><div>            print &quot;&quot;&quot;</div><div>            -------------------------------------------------------------</div>
<div>            Attack = Attack for 100% of damage.</div><div>            Defending = Attack for 50% of damage and endure 50% of damage.</div><div>            -------------------------------------------------------------</div>
<div>            &quot;&quot;&quot;</div><div>        elif choice == 4:</div><div>            sys.exit(0)</div></div>