SHARE
TWEET

team1.py

g0thy Dec 9th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from random import choice
  2. from random import shuffle  #for the next assignment
  3.  
  4. teamA = []
  5. teamB = []
  6.  
  7. players = ['Alpha', 'Bravo', 'Charlie', 'Delta', 'Echo', 'Foxtrot', 'Golf', 'Hotel', 'India', 'Juliet', 'Kilo', 'Lima', 'Mike', 'November', 'Oscar', 'Papa', 'Qubec', 'Romeo', 'Sierra', 'Tango', 'Uniform', 'Victor', 'Whiskey', 'Xray', 'Yankee', 'Zulu']
  8.  
  9. def add_player_to_team(team):
  10.     # Pick a player, add them to the team list and remove from players. someone cut and pasted!!
  11.     player_picked = choice(players)
  12.     team.append(player_picked)
  13.     players.remove(player_picked)
  14.  
  15. playersLen = len(players) #How many players?
  16.  
  17. loopCount = 0
  18.  
  19. for loop in range(playersLen): #stop when you run out of players
  20.     for x in players:    
  21.         add_player_to_team(teamA)
  22.         add_player_to_team(teamB)
  23.    
  24. print('Team A= ', teamA)    #printout the teams
  25. print('Team B= ', teamB)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top