Question 29
The students of IITM BS challenged their instructors to a cricket match. A Flask web application is built to track the scores. Below is the Flask app code that defines multiple routes for fetching scores dynamically.
from flask import Flask
app = Flask(__name__)
@app.route('/')def home(): return "Welcome to the IITM BS Cricket Match Scoreboard!"
@app.route('/score/<team>')def team_score(team): scores = {"students": 120, "instructors": 115} return f"{team.capitalize()} Score: {scores.get(team, 'Team not found')}"
@app.route('/score/<team>/<player>')def player_score(team, player): players = { "students": {"Rahul": 45, "Ananya": 30, "Karthik": 25}, "instructors": {"Prof.Prashant": 40, "Prof.Mayur": 35, "Dr.Subendu": 20} } return f"{player} ({team.capitalize()}) Scored: {players.get(team, {}).get(player, 'Player not found')}"
if __name__ == "__main__": app.run(debug=True)Based on the above data, answer the given subquestions.
What will be the output when the following URL is accessed?
Score: students
Students Score: 120
None of these
Team not found