I am writing a short program for my basketball team. I got a coach to divide the players into lists corresponding to a specific position. (List1 = Point Guard)
Using these lists, I want to create an output with all possible "valid" compositions.
I have currently written a basic program that selects 5 unique people from each list
How can I get this to loop in such a way that it prints out all the "Real" configurations of 5 players?
Any suggestions or directions are welcome!
Here is what I still have:
import sys
import random
list1 = ['Gabe', 'taylor', 'kyle', 'jay']
list2 = ['Gabe', 'Taylor', 'Kyle', 'Jay', 'James', 'John', 'Tyde','Chris', 'Bruno', 'David']
list3 = ['Gabe', 'Taylor', 'Kyle', 'Jay', 'James', 'John', 'Tyde','Chris', 'Bruno', 'David']
list4 = ['Kyle', 'James', 'John', 'Tyde','Bruno', 'Drew', 'Chris']
list5 = ['James', 'John', 'Brendan','Tim', 'Drew' ]
FinalList = []
position_lists = [list1, list2, list3, list4, list5]
for position_list in position_lists:
found_my_guy = False
while not found_my_guy:
selectedPerson = position_list[ random.randint( 0,len(position_list) -1 ) ]
if selectedPerson not in FinalList:
FinalList.append(selectedPerson)
found_my_guy = True
for person in FinalList:
sys.stdout.write(person + '\n')