City index

Report a typo

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.

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
___

Create a free account to access the full topic