When the following code is run, it throws an error. Without knowing this error, fix the error by adding only a single line of code.
Flask Sessions
One line fix
Report a typo
Write a program in Python 3
from flask import Flask, session
app = Flask(__name__)
languages = {
"en": "Hello, world!",
"fr": "Bonjour, le monde!",
"es": "Hola, mundo!"
}
@app.route("/")
def index():
session['lang'] = 'en'
return languages[session['lang']]
___
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.