Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import choice # bring in the choice function from random library
- teamA_picked_players = []
- teamB_picked_players = []
- my_players_list = ["Pete", "dave", "Simon", "Gerald", "Clive"]
- def add_player_to_team(team):
- picked = choice(my_players_list)
- team.append(picked)
- my_players_list.remove(picked)
- while len(my_players_list) > 0:
- add_player_to_team(teamA_picked_players)
- try:
- add_player_to_team(teamB_picked_players)
- except:
- pass
- print(f"Team A {teamA_picked_players} and has {len(teamA_picked_players)} players")
- print(f"Team B {teamB_picked_players} and has {len(teamB_picked_players)} players")
- print(my_players_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement