High School

Quidditch is a wizarding sport described by Ron Weasley as the "best game in the world." The sport is played on broomsticks and requires various kinds of players. Each goal earns a team 10 points, and a Quidditch game is completed when the Seeker of a team catches the snitch, earning the team 150 points.

Write a program that determines the winner of a Quidditch game by asking the user for:

1. The number of goals scored by each team.
2. The team that caught the snitch.

A game can end with a team winning, losing, or tying.

Score calculation: \(\text{score} = (\text{goals} \times 10) + 150\)

Answer :

Creating a program that will decide a Quidditch match's victor depending on the number of goals scored and which team managed to catch the snitch.

Here is an example of Python code:

print("Welcome to the Quidditch Game Score Calculator!")

# Get the number of goals scored by each team

team1_goals = int(input("Enter the number of goals scored by Team 1: "))

team2_goals = int(input("Enter the number of goals scored by Team 2: "))

# Get the team that caught the snitch

snitch_team = int(input("Enter the team that caught the snitch (1 for Team 1, 2 for Team 2, 0 for no team): "))

# Calculate the scores

team1_score = (team1_goals * 10) + 150

team2_score = (team2_goals * 10) + 150

# Determine the winner

if snitch_team == 1:

team1_score += 150

elif snitch_team == 2:

team2_score += 150

# Determine the outcome of the game

if team1_score > team2_score:

print("Team 1 wins the game!")

elif team1_score < team2_score:

print("Team 2 wins the game!")

else:

print("The game ends in a tie!")

# Display the final scores

print("Final Scores:")

print("Team 1:", team1_score)

print("Team 2:", team2_score)

To learn more about Python link is here

brainly.com/question/30427047

#SPJ4