Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Flask Basics Welcome to Flask Multiply View

Change the response to multiply the two arguments and return their product

I have tried this several ways and this is the answer most likely to pass. Currently reads, "Task 1 is no longer passing."

Please help =)

flask_app.py
from flask import Flask

app = Flask(__name__)

7 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

The outcome of multiplication is called a product so that's what you need to return. You don't need to multiply it another time.

from flask import Flask

app = Flask(__name__)

@app.route("/multiply")
@app.route("/multiply/<int:num1>/<int:num2>")
@app.route("/multiply/<float:num1>/<float:num2>")
@app.route("/multiply/<int:num1>/<float:num2>")
@app.route("/multiply/<float:num1>/<int:num2>")
def multiply(num1=2, num2=2):
  #Not updated until later in the challenge.
   return str(5 * 5 * (5*5))

in return str (5 *5 * (5*5)), I have done as asked and multiplied the two arguments and then multiplied their product, code should pass. please help =)

"Got 25 at /multiply/2.5/2"

from flask import Flask

app = Flask(name)

@app.route("/multiply") @app.route("/multiply/<int:num1>/<int:num2>") @app.route("/multiply/<float:num1>/<float:num2>") @app.route("/multiply/<int:num1>/<float:num2>") @app.route("/multiply/<float:num1>/<int:num2>") def multiply(num1=5, num2=5): #Not updated until later in the challenge. return str(5 * 5) return str

code not passing, what else could I be missing if not more math operations?

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

You're not using num1 or num2 in the output.

from flask import Flask

app = Flask(name) @app.route('/multiply') @app.route('/multiply/<int:arg1>/<int:arg2>') @app.route('/multiply/<float:arg1>/<float:arg2>') @app.route('/multiply/<float:arg1>/<int:arg2>') @app.route('/multiply/<int:arg1>/<float:arg2>')

def multiply(arg1, arg2): return "{} * {} is {}".format(arg1, arg2, arg1 * arg2)

I will try that again... I recall that using num1 and num2 was causing step 1 of 5 to fail... so I was certain it had to be done the integer way =D yipee!

return (num1 * num2)