[Tutor] AD&D Character generator problems

Justin Sheehy dworkin@ccs.neu.edu
04 Apr 2000 11:00:11 -0400

sjb@crosswinds.net writes:

> even if I tell the program not to it still re-rolls the character's
> stats. Hopefully someone here can spot the problem.

It's an operator precedence issue.

>     if goodstats == 'yes' or 'y':
> 	MakeStats()

This may be illustrative:

>>> if 'a' == 'b' or 1:
...     print 'NI!'

You should change the if to be something like:

if goodstats == 'yes' or goodstats == 'y':

If you don't want to be that wordy, you could do this instead:

if goodstats in ('yes', 'y'):

Good luck, and have fun.