def best_score_for(items, segments, subtotal=1.0):
    if not items:
        return subtotal
if not segments:
    return 0.0
segment, score = segments[0]
best_without = best_score_for(items, segments[1:], subtotal)
return max(best_score_for(items.difference(segment), segments[1:], subtotal *
    score), best_without) if items.issuperset(segment) else best_without
best_score_for(set('ABCDEFGHI'), segment_scores)
Establishing highest score for a set of combinations