Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import the random function
- import random
- team1 = []
- team2 = []
- players = ["Kevin", "Michael","Erica","Serge", "Dennis", "Judith"]
- #make a function that randomly picks players and divides them between team1 and team2
- def pickteams():
- count = len(players)
- for i in range (int(count)):
- if int(count)%2 ==0:
- p1 = random.choice(players)
- team1.append(p1)
- players.remove(p1)
- count = count - 1
- else:
- p2 = random.choice(players)
- team2.append(p2)
- players.remove(p2)
- count = count - 1
- print(team1)
- print(team2)
- pickteams()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement