Modern Application Development I, End Term
Consider the following Python code snippet.
from string import Template as makeTemplatefrom jinja2 import Templateimport sys
var = sys.argv[0]
data = {"var1": "Data scientist", "var2": "programming", "var3": "statistical", "var4": "insights"}
temp = "{{var1}} creates $var2 code with $var3 knowledge to create{{var4}}."
if var == "1": temp = makeTemplate(temp) output = temp.substitute(data) print(output)else: temp = Template(temp) output = temp.render(data) print(output)What will be printed on the terminal for the command python app.py 1 2 ?
Consider the following Python code snippet. from string import Template as makeTemplate from jinja2 import Template import sys var = sys.argv[0] data = {"var1": "Data scientist", "var2": "programming", "var3": "statistical", "var4": "insights"} temp = "{{var1}} creates $var2 code with $var3 knowledge to create {{var4}}." if var == "1": temp = makeTemplate(temp) output = temp.substitute(data) print(output) else: temp = Template(temp) output = temp.render(data) print(output) What will be printed on the terminal for the command `python app.py 1 2` ? Consider the following flask application running locally on `http://127.0.0.1:5000` ? from flask import Flask app = Flask(__name__) @app.route('/home/<string:url>') def get_url_str(url): return "string "+url @app.route('/home/<path:url>') def get_url_pth(url): return "path "+url app.run(debug = True) Which of the following URLs will throw a 404 Not Found error? Consider the following view function. from flask import Flask, request app = Flask(__name__) @app.route('/student', methods = ['GET', 'POST']) def show_details(): cred = request.args details = { 'Stream': cred['dept'], 'Roll': cred['roll'], 'Course': cred['course'] } return details app.run() If this flask app is running locally on http://127.0.0.1:5000, which of the following URLs will be handled by the controller correctly?