Advertisement
g0thy

team1.py

Dec 9th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement