import random
availableCountries = [0, 1, 2, 3, 4, 5, 6, 7]
firstTurnsCountries = []
secondTurnsCountries = []
def countryDivider(countryNum):
counter = 0
while True:
if counter == 8:
break
num = 7
if num > 0:
countryToAdd = random.randint(0,num)
if num == 0:
countryToAdd = 0
if counter %2 != 0:
firstTurnsCountries.append(availableCountries[countryToAdd])
if counter %2 == 0:
secondTurnsCountries.append(availableCountries[countryToAdd])
counter += 1
num -= 1
countries = len(availableCountries)
countryDivider(countries)
print secondTurnsCountries
print firstTurnsCountries
But this code can give the two lists the same numbers. And most of the time it gives each list multiple occurances of a number.
I was trying to add a line that deleted any number that was selected, so that it wouldn't be chosen again, so that's why i made the random number range get smaller with a decreasing counter, because the list would get smaller. But I can't get it to work.
BASICALLY: I need this to divide the numbers in the first list among the other two lists evenly, randomly, and so that no list gets the same country as another list, and no duplicate countries in one list.