Search code examples
pythonpython-3.xnumpyflaskflask-restful

How can i display the python scipt data within flask application


one: A.ipynb def factorial(n): if n == 0: return 1 else: return n * factorial(n-1)

i want when i click on the button the result will be appear in the application.

flask application

from A import factorial 
app = Flask(__name__)
@app.route('/')
def hello(): 
    #return factorial(5)
    return "Hello"
if __name__ == '__main__':
    app.run()```

how can i solve it 

Solution

  • You should use str to return number data.

    return str(factorial (5))