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 trialmichaelangelo owildeberry
18,173 PointsChange 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 =)
from flask import Flask
app = Flask(__name__)
7 Answers
Kenneth Love
Treehouse Guest TeacherThe outcome of multiplication is called a product so that's what you need to return. You don't need to multiply it another time.
michaelangelo owildeberry
18,173 Pointsfrom 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))
michaelangelo owildeberry
18,173 Pointsin 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 =)
michaelangelo owildeberry
18,173 Points"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
Treehouse Guest TeacherYou're not using num1
or num2
in the output.
Team Voywing
18,181 Pointsfrom 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)
michaelangelo owildeberry
18,173 PointsI 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!
MUZ140305 Kudakwashe Siziva
5,600 Pointsreturn (num1 * num2)