python - How can I reference a dictionary with boolean terms as values in a while-loop statement? -
i have dictionary:
flips_left = {'front flip': true, 'side flip': true, 'back flip': true }
all values true
and have while loop:
while flips_left[flip_choice] == true: flip_choice = raw_input("do flip ") if flip_choice in flips_left: if flips_left[flip_choice]: print flip_lines[flip_choice] flips_left[flip_choice] = false else: print "you did %s" % flip_choice else: print "that not type of flip" print "great! completed wod!"
i want way while loop exit when values in dict false.
any()
tests each of elements of passed iterable trueness.
while any(flips_left.itervalues()):
Comments
Post a Comment