Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import shuffle
- # initialises the three lists
- TeamA=[]
- TeamB=[]
- players=["Dawn", "Sarah", "Laura", "Carrie Anne","Trish","Caroline","Teresa","Julie"]
- # function to randomly sort players into team
- def sort_players(team):
- shuffle(players)
- name =players.pop()
- team.append(name)
- #main program to sort a list of players in to 2 teams
- x=int(len(players))
- x=int(x/2)
- for i in range(x):
- sort_players(TeamA)
- sort_players(TeamB)
- print("TeamA players are ",TeamA)
- print("TeamB players are ",TeamB)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement