# Sample Python Project # The President Jacob Biden decided to form a subcommittee of 4 senetors to study the Tax Evation in U.S. # Out of 4, 2 should be from 'Democrats' and 2 should be from 'Republicans'. # There are 4 Democrats and 3 Rupublicans at his disposal. Find out how many ways can he form a committee. # Democrats = ('James Smith','John Samuel','Jack Sparrow','Jay Screw') # Republicans = ('Henry Wilson','Hally Star', 'Hill Cook') import math D = 4 # (Number of democrats choose from) d = 2 # (Number of possibilities) print('Number of combination of democrats :', math.comb(D, d)) Demo = math.comb(D, d) R = 3 # (Number of republicans choose from) r = 2 # (Number of possibilities) print('Number of combination of republicans :', math.comb(R, r)) Repu = math.comb(R, r) com = Repu * Demo print('Number of combinations of Republicans and Democrats in the committee : ', com)
I got the number of combinations, But how to print the names in the combinations ?