Question 26
Prashant and Nikita are creating a quiz question paper collaboratively. They are each working on different sections — and complete their tasks in parallel. Meanwhile, Mayur is enjoying a single-player game that finishes when the game loop ends.
To compare productivity:
- If Prashant and Nikita (together) finish faster than Mayur, the winner is
"Team". - If Mayur finishes faster, he wins.
- If both take the same time, Mayur wins by default.
Prashant and Nikita send their task completion times to a Flask backend via query parameters.The server must simulate parallel execution of their tasks (i.e., max(prashant_time, nikita_time)) and compare it against Mayur's game time. The route returns who finishes faster.
from flask import Flask, jsonify, request
app = Flask(__name__)
@app.route('/task')def task(): prashant_time = int(request.args.get("prashant")) nikita_time = int(request.args.get("nikita", 3)) mayur_time = int(request.args.get("mayur", 6))
team_time = max(prashant_time, nikita_time) # parallel processing winner = "Team" if team_time < mayur_time else "Mayur"
return jsonify({ "winner": winner, "team_time": team_time, "mayur_time": mayur_time })Based on the above data, answer the given subquestions.