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 trialSteven Young
2,486 Pointswhy is this not passing? flask multiply view challenge 2 of 5
here is my code:
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/multiply')
@app.route('/mutliply/<int:number1>/<int:number2>')
def multiply(number1 = 5, number2 = 5):
return '{}'.format(number1 * number2)
#return str(number1 * number2)
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/multiply')
@app.route('/mutliply/<int:number1>/<int:number2>')
def multiply(number1 = 5, number2 = 5):
return '{}'.format(number1 * number2)
#return str(number1 * number2)
Steven Young
2,486 Pointsthis is the question:
Add a new route to multiply() that has two arguments. Add the same two arguments to the multiply() view. They should have defaults of 5.
4 Answers
Dan Johnson
40,533 PointsYou have a typo in the second route. You flipped the l and t in multiply. Fix that and you should be good to go.
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsHey Steven,
I think Dan spotted it, but feel free to circle back if this still doesn't pass.
Thanks.
Rodrigue Loredon
1,338 PointsHi all, I am struggling with that same challenge that is: "Add a new route to multiply() that has two arguments. Add the same two arguments to the multiply() view. They should have defaults of 5."
Can someone tell me why I get the error message: "Didn't get a 200 at /multiply/10/10".
This is my code:
from flask import Flask
app = Flask(__name__)
@app.route('/multiply')
@app.route('/multiply/(int:arg1)/(int:arg2)')
def multiply(arg1 = 5, arg2 = 5):
return str(arg1*arg2)
Dan Johnson
40,533 PointsYou'll want angle brackets instead of parentheses for your route arguments:
@app.route('/multiply/<int:arg1>/<int:arg2>')
Rodrigue Loredon
1,338 PointsThank you Dan!
Steven Young
2,486 PointsSteven Young
2,486 Pointserror message:
Bummer! Didn't get a 200 at /multiply/10/10