"Not enough Points" Python -


st = 5 statadd = 5 

there more had typed, none of relevant, copied this.

while statadd > 0:     addstat = raw_input("""you may distribute %s points base stats. add to? """ %(statadd))     if addstat == 'strength':             pointdeduction = raw_input("how many points wish add strength? (up %s points)" %(statadd))             if pointdeduction <= statadd:                     st += pointdeduction                     statadd -= pointdeduction             else:                     print "you not have many points distribute strength." 

you think should add points, keep getting same error "you not have many points distribute strength" when do. doing wrong here?

try convert inputs to int? otherwise it's string , doing arithmetic operations on lead unexpected results.

     while statadd > 0:     addstat = int(raw_input("""you may distribute %s points base stats. add to?  """ %(statadd)))     if addstat == 'strength':             pointdeduction = int(raw_input("how many points wish add strength? (up %s points)" %(statadd)))             if pointdeduction <= statadd:                     st += pointdeduction                     statadd -= pointdeduction             else:                     print "you not have many points distribute strength." 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -