Team allocator When playing team sports, the first thing you have to do is to pick the teams. One way of doing this is to choose team captains and let them choose the players for their teams. However, it might be fairer to pick people randomly. In this project, you’ll automate this process by building a tool in Python that picks teams randomly.
How it works This project will use Python’s random module to form teams, with randomly selected players. You will use lists (see p.103) to store the player’s names. The random module will then shuffle this list into a different order. Loops will be used to iterate through the list and display the players. Finally, an if statement (see p.105) checks to see if the user is happy with the selection.
Python 3.7.0 shell
Welcome to Team Allocator! Team 1 captain: Rose Team 1: Jean Ada Sue Claire Martin Harry Alice Craig Rose James
The list of players is displayed in the shell window
Random allocation This project will pick two teams and a captain for each team. When you run the program, it will display the chosen teams and captains on the screen.