My fonction doesn't work

Question:why my code do not work ?

**Current behavior:

Desired behavior

**Repl link:**https://replit.com/@1572395/FakeTintedGenericsoftware#main.py

code snippet

Welcome to the forums, @1572395!
Are you trying to run main.py, hi.py or hi2.py?

4 Likes

Assuming you are using main.py, the fixed code is here:

from flask import Flask

app = Flask('app')

@app.route('/')
def calcu():
  def add(input_param,other_param):
    resultat=int(input_param)+int(other_param)
    return resultat # instead of printing the result, return it for Flask
  def soustrac(input_param,other_param):
    resultat=int(input_param)-int(other_param)
    return resultat
  return add(1,2) # change these numbers

app.run(host='0.0.0.0', port=8080)

2 Likes