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

Steven Young
Steven Young
2,486 Points

why 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)
flask_app.py
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
Steven Young
2,486 Points

error message:

Bummer! Didn't get a 200 at /multiply/10/10

Steven Young
Steven Young
2,486 Points

this 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
Dan Johnson
40,533 Points

You have a typo in the second route. You flipped the l and t in multiply. Fix that and you should be good to go.

Rodrigue Loredon
Rodrigue Loredon
1,338 Points

Hi 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
Dan Johnson
40,533 Points

You'll want angle brackets instead of parentheses for your route arguments:

@app.route('/multiply/<int:arg1>/<int:arg2>')