The Code Sender

Report a typo

Write a function that receives a text and a response code as arguments, and then creates and returns a response object.

Note that the data variable that is provided to response_maker() that contains the text and the response code split by a semicolon.

Tip: Use the jsonify method to create a response with the data.

Sample Input 1:

Hello there, my friend!
200

Sample Output 1:

{"code":"200","message":"Hello there, my friend!"}
Write a program in Python 3
from flask import Flask, jsonify

app = Flask('main')
app.app_context()

@app.route('/<data>')
def response_maker(data):
text, status_code = data.split(';')

# your code here
___

Create a free account to access the full topic