Unexpected Python (and idle) crash when running my script -
python , idle both exited if run code. use python 3.2 , there may few errors made after changing code out of desperation.
my goal create file copies code separate file later use. recently, python 2.7 crashed , happening python 3.2. try code out on computer , see happens.
please give me tips, because annoying.
def creating(): print ('you have total of 70 points spend on str(strength), chr(charisma), dex(dexterity), int(intelligence), con(constitution).\nif put in greater amount restart character creation process; , if put smaller amount told can add more.\nyou may have limit of 18 on 1 attribute or restart stat creation process.') global st global ch global de global inte global con #it gives me error stuff above if doesn't crash st = (input('str:')) ch = (input('chr:')) de = (input('dex:')) inte = (input('int:')) con = (input('con:')) global scores score = st+ch+de+inte+inte+con global scores scores = 70-score #if have globals above crashes , if take away works. def bunnyoperation(): rew = open('c:/python32/charactersave.py','w') rew.write(('st=')+str(st)) rew.write(('\nch=')+str(ch)) rew.write(('\nde=')+str(de)) rew.write(('\ninte=')+str(inte)) rew.write(('\ncon=')+str(con)) rew.close() def scorecor(): if score == 70 , st<19 , ch<19 , de<19 , inte<19 , con<19: bunnyoperation() elif score>70: print ('you have total of many points.') creating() elif score<70: print ('you still have ')+str(scores)+(' points left') creating() elif st or ch or de or inte or con>18: print ('you set 1 of stats on 18.\nyou have restart.') creating() else: creating() creating()
declare global
variables outside scope of function. since script never calling 2 other methods, provide script creating()
:
global st st = 0 global ch ch= 0 global de de= 0 global inte inte= 0 global con con= 0 global score score=st+ch+de+inte+inte+con global scores scores=70-score def creating(): print ('you have total of 70 points spend on str(strength), chr(charisma), dex(dexterity), int(intelligence), con(constitution).\nif put in greater amount restart character creation process; , if put smaller amount told can add more.\nyou may have limit of 18 on 1 attribute or restart stat creation process.') #it gives me error stuff above if doesn't crash st=raw_input('str:') ch=(raw_input('chr:')) de=(raw_input('dex:')) inte=(raw_input('int:')) con=(raw_input('con:'))
call of creating()
asks inputs, , instance
>>> have total of 70 points spend on str(strength), chr(charisma), dex(dexterity), int(intelligence), con(constitution). if put in greater amount restart character creation process; , if put smaller amount told can add more. may have limit of 18 on 1 attribute or restart stat creation process. str:3 chr:2 dex:5 int:2 con:3 >>>
Comments
Post a Comment