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

Austin Hawkins-Seagram
Austin Hawkins-Seagram
5,720 Points

Flask's Shady Multiplication

So in task 2 of flask_app.py challenge, I wrote a url-input multiplier. it multiplies things in the regular way I would expect things to be multiplied.

But I get back an error message:

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

which equates to Bummer, 10x10 isn't 200.

Well, I don't know how to make 10x10 equal 200 (though I tried some sneaky ways to return 200, but they did not work).

anyway I am not one to blame the software for my mistakes. but like. 10x10=200...?

flask_app.py
from flask import Flask

app = Flask(__name__)

@app.route('/multiply')
@app.route('/multiply/<a>/<b>')
def multiply(a=5, b=5):
    return "{}".format(a*b)

1 Answer

Hi Austin,

I think the 200 is referring to the http status code 200 OK.

In this case, you went a little too far with the instructions. You weren't supposed to change the return value to use the arguments. That will come later. The response for now should still be 5 * 5.

Right now, your arguments are still strings so at the route /multiply/10/10 you're trying to do "10" * "10" which will lead to an error.