[Tutor] Python Help - How to end program

2010-07-28 Thread Jason MacFiggen
Python keeps looping when it gets past the int 0, how do I end the program when it the int 0 or > 0. my_hp = 50 mo_hp = 50 my_dmg = random.randrange(1, 20) mo_dmg = random.randrange(1, 20) endProgram = end() while True: if mo_hp < 0: print "The Lich King has

[Tutor] Python - RPG Combat System

2010-07-30 Thread Jason MacFiggen
I am have trouble figuring out how to make my program stop at 0 hit points if I run it, it always goes into the negative hitpoints... So my question is how do I make this program end at exactly 0 hit points every time instead of going over? and also, what can I do instead of writing print so

[Tutor] Simple Python Program

2010-07-30 Thread Jason MacFiggen
Can anyone tell me how to fix the errors I am getting if possible? I'm quite new and so confused... also how do I display the winner under the displayInfo function? import random def main(): print playerOne, playerTwo = inputNames(playerOne, PlayerTwo) while endProgram == 'no':

[Tutor] sys.exit help

2010-08-01 Thread Jason MacFiggen
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? import random import sys my_hp = 50 mo_hp = 50 menu1 = """ Menu Selections: 1 - Attack

[Tutor] Menu not working properly

2010-08-02 Thread Jason MacFiggen
My problem is choice 3. Exit, if you select no or put an invalid answer... It will run menu1... but then it runs name = raw_input ("Enter your character name. ") print "Your character name is:", name How can i make it so it prints menu1 like normal... then asks you to enter your selection