# 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 ?
For this you would need a data-structure to actually save the combinaiton - not just calculate their number.
Then you would need a list of the names and can just print it wit print(Demo[x] + " and " + Repu[y] by using the combinations somehow saved.
All your code does right now is using a function to calculate how many combination would be possible - it does not actually create any combinations itself.
Now I got it. It does not create any combination actually.!!!
Thank you for the feed back. I have to create 18 variables to store the 18 combinations ???. But first i have to create the combinations !!Not the number. OK. I 'll try for it. I hope your continued support.