you're right, of course. it occurred to me that, even if it were
manageable for a few items, it would quickly become absurd as the
number of items grew. this:

def get_pct():
        while True:
                pct_list=[['cash', 0], ['bond', 0], ['blue', 0], ['tech', 0], 
['dev',
0]]
                total=0
                for i in range(len(pct_list)):
                        pct_list[i][1]=input('Please enter the percentage value 
for %s: '
%pct_list[i][0])
                        total+=pct_list[i][1]
                if total == 100:
                        return pct_list
                        break
                else:
                        print "You've messed up, do it again..."

is much better, and easily maintainable by adding to the assignment for
pct_list. still leaves me with checking for strings though, in case
someone types 'donut' at the prompt...

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to