Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions calculator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()