You have the following address: /index/. When running the /index/10001 route, your program should check if there is a city with the corresponding index in the city_dict dictionary. If the dictionary contains the index, print the name of this city. If there's no such index, print the following message: There is no city with this index.
Routes
City index
Report a typo
Write a program in Python 3
from flask import Flask
app = Flask('main')
app.app_context()
city_dict = {10001: "New York",
20001: "Washington",
101000: "Moscow"}
@app.route()
def render_city():
pass # your code here
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.