From 4d3bd0e6139b9bb88616b31fe20edf05a03b0ef7 Mon Sep 17 00:00:00 2001 From: Ananya <65886348+Ananyaiitbhilai@users.noreply.github.com> Date: Thu, 3 Mar 2022 15:56:25 +0530 Subject: [PATCH] Update __init__.py --- calculator/__init__.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/calculator/__init__.py b/calculator/__init__.py index 8d6bb89..95c92ac 100755 --- a/calculator/__init__.py +++ b/calculator/__init__.py @@ -30,18 +30,30 @@ def XYZ(): return 1 -@app.route("/findmin", methods=["POST"]) -def findmin(): +@app.route("/subtract", methods=["POST"]) +def subtract(): jsonStr = request.get_json() jsonObj = json.loads(jsonStr) a=int(jsonObj['N1']) b=int(jsonObj['N2']) - minimum = min(a,b) - response = "Minimum of 2 numbers = " + str(minimum) + diff = a-b + response = "Difference of 2 numbers = " + str(diff) return response - +@app.route("/find_min", methods=["POST"]) +def FIND_MIN(): + jsonStr = request.get_json() + jsonObj = json.loads(jsonStr) + a=int(jsonObj['N1']) + b=int(jsonObj['N2']) + if (a > b): + response = "The minimum of the two number is" + str(b) + elif (a < b): + response = "The minimum of the two number is" + str(a) + else: + response = "Both the numbers are equal" + if __name__== "__main__": app.run()