Recap - Tournament Tracker
Part of the Logic & Flow section of Coddy's Python journey — lesson 38 of 78.
Challenge
HardIn a competitive gaming tournament, players participate in different matches. Your task is to analyze player participation across three matches using Python sets.
You'll be given three sets of players:
match1: Players who participated in Match 1match2: Players who participated in Match 2match3: Players who participated in Match 3
Your task is to:
- Find players who participated in all three matches
- Identify players who participated in exactly two matches
- Determine players who participated in only one match
- Count the total number of unique players in the tournament
- Find players who participated in Match 1 but not in Match 2 or Match 3
Print the results in the following format:
- Use
sorted(list(set_name))to display players in alphabetical order - Print the exact output format shown in the example
Example Input:
{"Alice", "Bob", "Charlie", "Diana"}
{"Charlie", "Diana", "Eve", "Frank"}
{"Alice", "Diana", "Frank", "George"}Example Output:
Players in all matches: ['Diana']
Players in exactly two matches: ['Alice', 'Charlie', 'Frank']
Players in only one match: ['Bob', 'Eve', 'George']
Total unique players: 7
Players in Match 1 only: ['Bob']Try it yourself
# Read input for the three matches
match1 = eval(input())
match2 = eval(input())
match3 = eval(input())
# 1. Find players who participated in all three matches
# 2. Find players who participated in exactly two matches
# 3. Find players who participated in only one match
# 4. Count total unique players
# 5. Find players in Match 1 only
# Print results in the specified formatAll lessons in Logic & Flow
1Variables Exploration
ConstantsMultiple Variable AssignmentsSwapping VariablesPlaceholder VariablesRound NumbersList Casting4Contact Book Application
Display MenuAdd Contact7Sets Part 2
Mathematical Operations Part 1Mathematical Operations Part 2Recap - Treasure HuntSubsets and SupersetsIterating Over SetsRecap - Tournament Tracker2Dictionaries Part 1
What is a Dictionary?Creating a DictionaryAccessing ValuesModifying DictionariesRecap - Recipe Manager5Advanced Decision Making
Ternary OperatorMembership ChecksIdentity ChecksIndentation ErrorsRecap - Vacation Filter8Student Records Manager
Project OverviewAdd Student11Advanced Functions
Returning Multiple ValuesLambda Functions Part 1Lambda Functions Part 2Recap Challenge - Lambda SortRecursive Functions Part 1Recursive Functions Part 2Recap - Sum Nested List14Higher-Order Functions
The Map FunctionThe Filter FunctionRecap - Email ValidatorRecap - Number Processor3Dictionaries Part 2
Dictionary MethodsNested DictionariesChecking for KeysLooping Through DictionariesRecap - Frequency Counter9Advanced Data Aggregation
Using SumFinding Minimum and MaximumSorting Data EfficientlyRecap - Dictionary Sorter