Random draw for a competition.
Competitions often include a first round where teams are drawn against each other randomly.
⭐⭐⭐
Write a program that allows the user to enter any number of team names. The computer shuffles the teams and then outputs all the team names two at a time. If there are an odd number of teams, the word “bye” is added to the list so that one team gets an automatic place in the second round. You only need to simulate the draw for round one.
Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.
input_teams that:draw_teams that:main program so that:Enter the name of a team: England
Enter the name of a team: Germany
Add two more teams? y/n :y
Enter the name of a team: Spain
Enter the name of a team: Italy
Add two more teams? y/n :n
The draw is:
Spain v Germany
England v Italy
Enter the name of a team: Brazil
Enter the name of a team: Uraguay
Add two more teams? y/n :y
Enter the name of a team: Peru
Enter the name of a team: Argentina
Add two more teams? y/n :y
Enter the name of a team: Ecuador
Enter the name of a team: bye
Add two more teams? y/n :n
The draw is:
Brazil v Argentina
bye v Ecuador
Uraguay v Peru